feat: persist workflow controls and settle stopped branches
This commit is contained in:
@@ -35,6 +35,10 @@ type Instance struct {
|
||||
DeadlineAt time.Time `db:"deadline_at"`
|
||||
// CancelRequestedAt 取消意图的持久化时间;不等于取消已完成;可为空,表示尚未设置该关联或值。
|
||||
CancelRequestedAt *time.Time `db:"cancel_requested_at"`
|
||||
// StopKind 首次停止原因,CANCEL为用户取消、FAILURE为固定失败策略;进入核查后仍保留,为空表示未要求结清。
|
||||
StopKind *string `db:"stop_kind"`
|
||||
// StopRequestedAt 首次停止意图的数据库时间,重报或后续取消不覆盖;与StopKind同时为空。
|
||||
StopRequestedAt *time.Time `db:"stop_requested_at"`
|
||||
// CompletedAt 终结时间;非终态为空,进入终态时必须写入。
|
||||
CompletedAt *time.Time `db:"completed_at"`
|
||||
// RetryOf 来源记录标识,人工重新发起时用于保留历史关联;可为空,表示尚未设置该关联或值。
|
||||
|
||||
@@ -17,7 +17,7 @@ type PendingAdvance struct {
|
||||
StepID core.ID `db:"step_id"`
|
||||
// ExpectedStepRevision 恢复推进时要求的步骤版本,避免使用过期检查点。
|
||||
ExpectedStepRevision uint64 `db:"expected_step_revision"`
|
||||
// Checkpoint 版本化 JSON;ROOT用于分批/暂停续接,TIMER/POLL另固定激活ID以隔离旧唤醒。
|
||||
// Checkpoint 版本化 JSON;ROOT用于分批/暂停/停止结清续接,TIMER/SIGNAL/POLL另固定激活ID以隔离旧唤醒。
|
||||
Checkpoint core.JSON `db:"checkpoint"`
|
||||
// AvailableAt 最早可被领取或处理的时间,统一 UTC。
|
||||
AvailableAt time.Time `db:"available_at"`
|
||||
|
||||
@@ -17,7 +17,7 @@ func (s InstanceState) Terminal() bool {
|
||||
return s == InstanceSucceeded || s == InstanceFailed || s == InstanceCancelled
|
||||
}
|
||||
func (i Instance) AllowsNewWork() bool {
|
||||
return !i.Paused && i.CancelRequestedAt == nil && (i.State == InstanceRunning || i.State == InstanceWaiting)
|
||||
return !i.Paused && i.StopKind == nil && i.CancelRequestedAt == nil && (i.State == InstanceRunning || i.State == InstanceWaiting)
|
||||
}
|
||||
|
||||
type NodeKind string
|
||||
|
||||
Reference in New Issue
Block a user