feat: establish Orbit models, migrations and development baseline
This commit is contained in:
74
weave/model/state.go
Normal file
74
weave/model/state.go
Normal file
@@ -0,0 +1,74 @@
|
||||
package model
|
||||
|
||||
// InstanceState 描述流程执行状态,独立的 Paused 标记控制是否允许新工作。
|
||||
type InstanceState string
|
||||
|
||||
const (
|
||||
InstanceRunning InstanceState = "RUNNING"
|
||||
InstanceWaiting InstanceState = "WAITING"
|
||||
InstanceCancelling InstanceState = "CANCELLING"
|
||||
InstanceNeedsReview InstanceState = "NEEDS_REVIEW"
|
||||
InstanceSucceeded InstanceState = "SUCCEEDED"
|
||||
InstanceFailed InstanceState = "FAILED"
|
||||
InstanceCancelled InstanceState = "CANCELLED"
|
||||
)
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
type NodeKind string
|
||||
|
||||
const (
|
||||
NodeTask NodeKind = "TASK" // 通过 Pulse 执行业务处理器。
|
||||
NodeBranch NodeKind = "BRANCH" // 按已保存结果选择条件路径。
|
||||
NodeParallel NodeKind = "PARALLEL" // 展开有界并行分支。
|
||||
NodeJoin NodeKind = "JOIN" // 按规则汇合并行结果。
|
||||
NodeSignal NodeKind = "SIGNAL" // 等待业务信号。
|
||||
NodeTimer NodeKind = "TIMER" // 等待指定时间。
|
||||
NodePoll NodeKind = "POLL" // 有界重复查询节点。
|
||||
)
|
||||
|
||||
type StepState string
|
||||
|
||||
const (
|
||||
StepBlocked StepState = "BLOCKED"
|
||||
StepReady StepState = "READY"
|
||||
StepActive StepState = "ACTIVE"
|
||||
StepWaiting StepState = "WAITING"
|
||||
StepNeedsReview StepState = "NEEDS_REVIEW"
|
||||
StepSucceeded StepState = "SUCCEEDED"
|
||||
StepFailed StepState = "FAILED"
|
||||
StepCancelled StepState = "CANCELLED"
|
||||
StepSkipped StepState = "SKIPPED"
|
||||
)
|
||||
|
||||
type WaitState string
|
||||
|
||||
const (
|
||||
WaitWaiting WaitState = "WAITING"
|
||||
WaitSatisfied WaitState = "SATISFIED"
|
||||
WaitExpired WaitState = "EXPIRED"
|
||||
WaitCancelled WaitState = "CANCELLED"
|
||||
)
|
||||
|
||||
type SignalState string
|
||||
|
||||
const (
|
||||
SignalPending SignalState = "PENDING"
|
||||
SignalConsumed SignalState = "CONSUMED"
|
||||
SignalExpired SignalState = "EXPIRED"
|
||||
SignalRejected SignalState = "REJECTED"
|
||||
)
|
||||
|
||||
type InboxState string
|
||||
|
||||
const (
|
||||
InboxPending InboxState = "PENDING"
|
||||
InboxLeased InboxState = "LEASED"
|
||||
InboxProcessed InboxState = "PROCESSED"
|
||||
InboxQuarantined InboxState = "QUARANTINED"
|
||||
)
|
||||
Reference in New Issue
Block a user