models

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package models - system data models

Package models - system data models

Package models - system data models

Package models - system data models

Index

Constants

View Source
const (
	// WorkflowExecutionTaskCreator the hard coded Creator stamped on every Task the workflow
	// scheduler submits to the Task Engine to run workflow step executions.
	//
	// **IMPORTANT:** Library users must never submit their own Tasks under this Creator. The
	// workflow scheduler subscribes to notify:creator:<this> to receive step-task feedback,
	// so any foreign task using it would be misread as workflow step feedback.
	WorkflowExecutionTaskCreator = "__TASKING_WORKFLOW_ENGINE_SCHEDULER__"

	// WorkflowExecutionTaskName the hard coded name used to register the workflow
	// step execution Task process handler with the Task Engine.
	//
	// **IMPORTANT:** Library users must never register their own Task process handler
	// under this name, as that breaks the workflow engine.
	WorkflowExecutionTaskName = "__EXECUTE_WORKFLOW_STEP__"
)
View Source
const MaxRetryDelay = 5 * time.Minute

MaxRetryDelay hard upper bound on the delay between retries. Any delay longer than this is not sensible, so all computed delays are clamped to it regardless of a task's configured MaxDelay.

Variables

This section is empty.

Functions

func BuildNotifyCreatorChannelName

func BuildNotifyCreatorChannelName(creator string) string

BuildNotifyCreatorChannelName the per-creator channel: `notify:creator:<creator>`

func BuildNotifyCreatorTypeChannelName

func BuildNotifyCreatorTypeChannelName(creator string, eventType SystemEventTypeENUM) string

BuildNotifyCreatorTypeChannelName the creator∩type channel: `notify:creator:<creator>:type:<type>`

func BuildNotifyFirehoseChannelName

func BuildNotifyFirehoseChannelName() string

BuildNotifyFirehoseChannelName the firehose channel carrying every event: `notify:all`

func BuildNotifySubjectChannelName

func BuildNotifySubjectChannelName(subjectType, subjectID string) string

BuildNotifySubjectChannelName the per-subject channel: `notify:subject:<subject-type>:<subject-id>`

func BuildNotifyTypeChannelName

func BuildNotifyTypeChannelName(eventType SystemEventTypeENUM) string

BuildNotifyTypeChannelName the per-event-type channel: `notify:type:<type>`

func ParseIPCMessage

func ParseIPCMessage(validator *validator.Validate, msg []byte) (interface{}, error)

ParseIPCMessage parse the IPC message based on type

func PrepareIPCMsgCancelTask

func PrepareIPCMsgCancelTask(
	sender string, taskID string, timestamp time.Time,
) goutilsRedis.QueueMessageEnvelope

PrepareIPCMsgCancelTask build IPC message `IPC_TASK_ENG_CANCEL_TASK`

func PrepareIPCMsgNewPendingTask

func PrepareIPCMsgNewPendingTask(
	sender string, taskID string, timestamp time.Time,
) goutilsRedis.QueueMessageEnvelope

PrepareIPCMsgNewPendingTask build IPC message `IPC_TASK_ENG_NEW_TASK`

func PrepareIPCMsgTaskExecutionEngineFailed

func PrepareIPCMsgTaskExecutionEngineFailed(
	sender string, instanceID string, timestamp time.Time,
) goutilsRedis.QueueMessageEnvelope

PrepareIPCMsgTaskExecutionEngineFailed build IPC message `IPC_TASK_ENG_ENGINE_FAILED`

func PrepareIPCMsgTaskExecutionProcessFailed

func PrepareIPCMsgTaskExecutionProcessFailed(
	sender string,
	instanceID string,
	disposition *TaskFailureDispositionENUM,
	timestamp time.Time,
) goutilsRedis.QueueMessageEnvelope

PrepareIPCMsgTaskExecutionProcessFailed build IPC message `IPC_TASK_ENG_EXECUTE_FAILED`. A nil disposition is treated as retryable by the scheduler.

func PrepareIPCMsgTaskExecutionProcessSucceeded

func PrepareIPCMsgTaskExecutionProcessSucceeded(
	sender string, instanceID string, timestamp time.Time,
) goutilsRedis.QueueMessageEnvelope

PrepareIPCMsgTaskExecutionProcessSucceeded build IPC message `IPC_TASK_ENG_EXECUTE_SUCCEEDED`

func PrepareIPCMsgTaskExecutionRequested

func PrepareIPCMsgTaskExecutionRequested(
	sender string, instanceID string, timestamp time.Time,
) goutilsRedis.QueueMessageEnvelope

PrepareIPCMsgTaskExecutionRequested build IPC message `IPC_TASK_ENG_PENDING_INSTANCE`

func PrepareIPCMsgTaskMaintenance

func PrepareIPCMsgTaskMaintenance(
	sender string, timestamp time.Time,
) goutilsRedis.QueueMessageEnvelope

PrepareIPCMsgTaskMaintenance build IPC message `IPC_TASK_ENG_MAINTENANCE`

func PrepareIPCMsgWFCancelWorkflow

func PrepareIPCMsgWFCancelWorkflow(
	sender string, workflowID string, timestamp time.Time,
) goutilsRedis.QueueMessageEnvelope

PrepareIPCMsgWFCancelWorkflow build IPC message `IPC_WF_ENG_CANCEL_WORKFLOW`

func PrepareIPCMsgWFMaintenance

func PrepareIPCMsgWFMaintenance(
	sender string, timestamp time.Time,
) goutilsRedis.QueueMessageEnvelope

PrepareIPCMsgWFMaintenance build IPC message `IPC_WF_ENG_MAINTENANCE`

func PrepareIPCMsgWFProcessWorkflow

func PrepareIPCMsgWFProcessWorkflow(
	sender string, workflowID string, timestamp time.Time,
) goutilsRedis.QueueMessageEnvelope

PrepareIPCMsgWFProcessWorkflow build IPC message `IPC_WF_ENG_PROCESS_WORKFLOW`

func PrepareIPCMsgWFReviveWorkflow

func PrepareIPCMsgWFReviveWorkflow(
	sender string, workflowID string, newDeadline *time.Time, timestamp time.Time,
) goutilsRedis.QueueMessageEnvelope

PrepareIPCMsgWFReviveWorkflow build IPC message `IPC_WF_ENG_REVIVE_WORKFLOW`. A nil newDeadline means no deadline change.

func PrepareIPCMsgWFScheduleStep

func PrepareIPCMsgWFScheduleStep(
	sender string, stepID string, timestamp time.Time,
) goutilsRedis.QueueMessageEnvelope

PrepareIPCMsgWFScheduleStep build IPC message `IPC_WF_ENG_SCHEDULE_STEP`

func PrepareIPCMsgWFStepExecUpdate

func PrepareIPCMsgWFStepExecUpdate(
	sender string, stepID string, newStepState WorkflowStepStateENUM, timestamp time.Time,
) goutilsRedis.QueueMessageEnvelope

PrepareIPCMsgWFStepExecUpdate build IPC message `IPC_WF_ENG_STEP_EXEC_UPDATE`. newStepState is the already-resolved terminal step outcome.

func PrepareIPCMsgWFStepTaskUpdate

func PrepareIPCMsgWFStepTaskUpdate(
	sender string, taskID string, newStepState WorkflowStepStateENUM, timestamp time.Time,
) goutilsRedis.QueueMessageEnvelope

PrepareIPCMsgWFStepTaskUpdate build IPC message `IPC_WF_ENG_STEP_TASK_UPDATE`. newStepState is the terminal step outcome mapped from the source task event; the worker resolves taskID -> step.

func RegisterWithValidator

func RegisterWithValidator(v *validator.Validate) error

RegisterWithValidator register with the validator this custom validation support

@param v *validator.Validate - the validator to register against
@return whether successful

Types

type BaseIPCMessage

type BaseIPCMessage struct {
	// ID message ID
	ID string `json:"id" validate:"required"`
	// Type message type
	Type IPCMessageTypeEnum `json:"type" validate:"required,ipc_msg_type"`
	// Sender name of the sending entity
	Sender string `json:"sender" validate:"required"`
	// Timestamp message timestamp
	Timestamp time.Time `json:"timestamp"`
}

BaseIPCMessage base IPC message object

func (BaseIPCMessage) StringPayload

func (q BaseIPCMessage) StringPayload() (string, error)

StringPayload return its payload as a string. This lets BaseIPCMessage be sent directly for payload-less message types (e.g. IPCMsgTypeWFMaintenance).

type IPCMessageExecuteInstance

type IPCMessageExecuteInstance struct {
	BaseIPCMessage
	// InstanceID ID of the task execution instance referenced
	InstanceID string `json:"instance_id" validate:"required"`
	// Disposition for an EXECUTE_FAILED message, whether the failure is retryable. Nil (the only
	// value for non-failure messages, and the default for a failure) is treated as retryable.
	Disposition *TaskFailureDispositionENUM `json:"disposition,omitempty" validate:"omitempty,task_failure_disposition"`
}

IPCMessageExecuteInstance system task execution instance related IPC message object

func (IPCMessageExecuteInstance) StringPayload

func (q IPCMessageExecuteInstance) StringPayload() (string, error)

StringPayload return its payload as a string

type IPCMessageQueueError

type IPCMessageQueueError struct{ goutils.BaseError }

IPCMessageQueueError encountered error operating the IPC message queue

func NewIPCMessageQueueError

func NewIPCMessageQueueError(message string, core error, getCallStack bool) IPCMessageQueueError

NewIPCMessageQueueError build a IPCMessageQueueError, optionally capturing the call stack.

type IPCMessageSystemTask

type IPCMessageSystemTask struct {
	BaseIPCMessage
	// TaskID ID of the task referenced
	TaskID string `json:"task_id" validate:"required"`
}

IPCMessageSystemTask system task related IPC message object

func (IPCMessageSystemTask) StringPayload

func (q IPCMessageSystemTask) StringPayload() (string, error)

StringPayload return its payload as a string

type IPCMessageTypeEnum

type IPCMessageTypeEnum string

IPCMessageTypeEnum IPC message type ENUM

const (
	// IPCMsgTypeNewTask IPC message indicating new task entry is defined and
	// need scheduling for execution.
	IPCMsgTypeNewTask IPCMessageTypeEnum = "IPC_TASK_ENG_NEW_TASK"
	// IPCMsgTypeCancelTask IPC message cancelling a system task
	IPCMsgTypeCancelTask IPCMessageTypeEnum = "IPC_TASK_ENG_CANCEL_TASK"
	// IPCMsgTypePendingInstance IPC message containing an execution instance
	// pending processing
	IPCMsgTypePendingInstance IPCMessageTypeEnum = "IPC_TASK_ENG_PENDING_INSTANCE"
	// IPCMsgTypeExecuteSucceeded IPC message indicating an execution instance
	// complete successfully
	IPCMsgTypeExecuteSucceeded IPCMessageTypeEnum = "IPC_TASK_ENG_EXECUTE_SUCCEEDED"
	// IPCMsgTypeExecuteFailed IPC message indicating an execution instance failed
	// during processing
	IPCMsgTypeExecuteFailed IPCMessageTypeEnum = "IPC_TASK_ENG_EXECUTE_FAILED"
	// IPCMsgTypeEngineFailed IPC message indicating the core task engine failed
	// to operate correctly on an execution instance (e.g. the receiver could not
	// claim it, or could not submit it to the executor). This is an engine-level
	// failure, distinct from IPCMsgTypeExecuteFailed which reports a failure
	// during actual task execution.
	IPCMsgTypeEngineFailed IPCMessageTypeEnum = "IPC_TASK_ENG_ENGINE_FAILED"
	// IPCMsgTypeTaskMaintenance IPC message triggering the task scheduler's periodic
	// maintenance sweep. Self-enqueued by the maintenance interval timer onto the
	// scheduler's own queue; carries no payload beyond the base message.
	IPCMsgTypeTaskMaintenance IPCMessageTypeEnum = "IPC_TASK_ENG_MAINTENANCE"

	// IPCMsgTypeWFProcessWorkflow IPC message asking the workflow scheduler to process a
	// workflow: start it (PENDING -> RUNNING) on first receipt and fan out startable steps.
	IPCMsgTypeWFProcessWorkflow IPCMessageTypeEnum = "IPC_WF_ENG_PROCESS_WORKFLOW"
	// IPCMsgTypeWFScheduleStep IPC message asking the workflow scheduler to dispatch one
	// workflow step to the task engine.
	IPCMsgTypeWFScheduleStep IPCMessageTypeEnum = "IPC_WF_ENG_SCHEDULE_STEP"
	// IPCMsgTypeWFStepExecUpdate IPC message delivering a workflow step's already-resolved
	// terminal outcome to the scheduler's execution-update reducer. Produced by the notify
	// callback adapter (task terminal event -> step state) and by the maintenance sweep.
	IPCMsgTypeWFStepExecUpdate IPCMessageTypeEnum = "IPC_WF_ENG_STEP_EXEC_UPDATE"
	// IPCMsgTypeWFStepTaskUpdate IPC message delivering a step's terminal outcome keyed by the
	// executing TASK ID - the notify fast-path feedback. Produced by the notify callback adapter
	// (which has only the task ID and does no DB work); the scheduler worker resolves task -> step
	// before invoking the step-keyed execution-update reducer.
	IPCMsgTypeWFStepTaskUpdate IPCMessageTypeEnum = "IPC_WF_ENG_STEP_TASK_UPDATE"
	// IPCMsgTypeWFReviveWorkflow IPC message asking the workflow scheduler to revive a
	// FAILED/TIMED_OUT workflow (optionally with a new deadline).
	IPCMsgTypeWFReviveWorkflow IPCMessageTypeEnum = "IPC_WF_ENG_REVIVE_WORKFLOW"
	// IPCMsgTypeWFCancelWorkflow IPC message asking the workflow scheduler to cancel a workflow.
	IPCMsgTypeWFCancelWorkflow IPCMessageTypeEnum = "IPC_WF_ENG_CANCEL_WORKFLOW"
	// IPCMsgTypeWFMaintenance IPC message triggering the workflow scheduler's periodic
	// recovery/liveness maintenance sweep. Self-enqueued by the maintenance interval timer;
	// carries no payload beyond the base message.
	IPCMsgTypeWFMaintenance IPCMessageTypeEnum = "IPC_WF_ENG_MAINTENANCE"
)

func (IPCMessageTypeEnum) Values

Values all valid IPCMessageTypeEnum values

type IPCMessageWorkflow

type IPCMessageWorkflow struct {
	BaseIPCMessage
	// WorkflowID ID of the workflow referenced
	WorkflowID string `json:"workflow_id" validate:"required"`
}

IPCMessageWorkflow a workflow-scoped IPC message referencing a single workflow by ID. Shared by IPCMsgTypeWFProcessWorkflow and IPCMsgTypeWFCancelWorkflow (same shape, distinguished by Type), mirroring how IPCMessageSystemTask is shared by the new/cancel task messages.

func (IPCMessageWorkflow) StringPayload

func (q IPCMessageWorkflow) StringPayload() (string, error)

StringPayload return its payload as a string

type IPCMessageWorkflowRevive

type IPCMessageWorkflowRevive struct {
	BaseIPCMessage
	// WorkflowID ID of the workflow to revive
	WorkflowID string `json:"workflow_id" validate:"required"`
	// NewDeadline optional new workflow deadline
	NewDeadline *time.Time `json:"new_deadline,omitempty"`
}

IPCMessageWorkflowRevive asks the scheduler to revive a FAILED/TIMED_OUT workflow. NewDeadline is optional: nil/absent means no deadline change (valid for a FAILED revive); present extends the deadline (required for a TIMED_OUT revive). The "required iff TIMED_OUT" rule is enforced in the scheduler handler against live workflow state, not by a struct tag. Used by IPCMsgTypeWFReviveWorkflow.

func (IPCMessageWorkflowRevive) StringPayload

func (q IPCMessageWorkflowRevive) StringPayload() (string, error)

StringPayload return its payload as a string

type IPCMessageWorkflowStep

type IPCMessageWorkflowStep struct {
	BaseIPCMessage
	// StepID ID of the workflow step referenced
	StepID string `json:"step_id" validate:"required"`
}

IPCMessageWorkflowStep a step-scoped IPC message referencing a single workflow step by ID. Used by IPCMsgTypeWFScheduleStep.

func (IPCMessageWorkflowStep) StringPayload

func (q IPCMessageWorkflowStep) StringPayload() (string, error)

StringPayload return its payload as a string

type IPCMessageWorkflowStepExecUpdate

type IPCMessageWorkflowStepExecUpdate struct {
	BaseIPCMessage
	// StepID ID of the workflow step referenced
	StepID string `json:"step_id" validate:"required"`
	// NewStepState the resolved new step state. The workflow_step_state macro accepts any step
	// state; the reducer additionally enforces that it is a terminal outcome
	// (COMPLETE/FAILED/TIMED_OUT/CANCELLED) at handling time.
	NewStepState WorkflowStepStateENUM `json:"new_step_state" validate:"required,workflow_step_state"`
}

IPCMessageWorkflowStepExecUpdate delivers a workflow step's already-resolved terminal outcome to the scheduler's execution-update reducer (keyed [step ID, new step state]). The producers (the notify callback adapter and the maintenance sweep) resolve the task-event-type -> step state mapping before enqueueing, so the reducer never sees raw task event types. Used by IPCMsgTypeWFStepExecUpdate.

func (IPCMessageWorkflowStepExecUpdate) StringPayload

func (q IPCMessageWorkflowStepExecUpdate) StringPayload() (string, error)

StringPayload return its payload as a string

type IPCMessageWorkflowStepTaskUpdate

type IPCMessageWorkflowStepTaskUpdate struct {
	BaseIPCMessage
	// TaskID ID of the task whose terminal event drove this update
	TaskID string `json:"task_id" validate:"required"`
	// NewStepState the resolved new step state. The workflow_step_state macro accepts any step
	// state; the reducer additionally enforces that it is a terminal outcome
	// (COMPLETE/FAILED/TIMED_OUT/CANCELLED) at handling time.
	NewStepState WorkflowStepStateENUM `json:"new_step_state" validate:"required,workflow_step_state"`
}

IPCMessageWorkflowStepTaskUpdate delivers a step's terminal outcome keyed by the executing TASK ID - the notify fast-path feedback. The notify callback adapter produces it from a terminal task event (mapping the event type -> step state) while holding only the task ID and doing no DB work; the scheduler worker later resolves task -> step and invokes the step-keyed execution-update reducer. Used by IPCMsgTypeWFStepTaskUpdate.

func (IPCMessageWorkflowStepTaskUpdate) StringPayload

func (q IPCMessageWorkflowStepTaskUpdate) StringPayload() (string, error)

StringPayload return its payload as a string

type NewWorkflowParameter

type NewWorkflowParameter struct {
	// Name of the workflow
	Name string `json:"name" validate:"required"`

	// Metadata relating to the workflow
	Metadata interface{} `json:"metadata,omitempty"`

	// Deadline the workflow must be completed by this deadline
	Deadline time.Time `json:"deadline" validate:"required"`

	// Steps of the workflow keyed by each step's name
	Steps map[string]NewWorkflowStepParameter `json:"steps" validate:"required,gte=1,dive"`
}

NewWorkflowParameter new workflow parameters

func (NewWorkflowParameter) IsValid

func (p NewWorkflowParameter) IsValid(validator *validator.Validate) error

IsValid verifies this new workflow parameter is valid

  • The steps did not depend on self
  • The steps did not depend on unknown parent steps
  • The step dependencies formed a DAG

type NewWorkflowStepParameter

type NewWorkflowStepParameter struct {
	// Name of the workflow step
	Name string `json:"name" validate:"required"`

	// Type workflow step type which indicates which processor should run the step
	Type string `json:"type" validate:"required"`

	// Parameters optional parameters needed for processing the step
	Parameters interface{} `json:"parameters,omitempty"`

	// Metadata relating to the workflow step
	Metadata interface{} `json:"metadata,omitempty"`

	// RetryParams retry parameters in case of failure
	RetryParams TaskRetryParameters `json:"retry_params" validate:"required"`

	// ParentSteps parent steps this step depends on. Parent steps are specified by name.
	ParentSteps map[string]bool `json:"parent_steps"`
}

NewWorkflowStepParameter new workflow step parameters

type NonRecoverableError

type NonRecoverableError struct{ goutils.BaseError }

NonRecoverableError a task execution failure a TaskExecutionProcessor considers permanent: retrying it will not help (e.g. malformed input, a resource that will never exist). A processor wraps its returned error in a NonRecoverableError to opt the failure out of the task's retry policy; the failure is still an ordinary task-execution failure (reported as EXECUTE_FAILED with a NON_RETRYABLE disposition), distinct from an engine-level failure.

func NewNonRecoverableError

func NewNonRecoverableError(message string, core error, getCallStack bool) NonRecoverableError

NewNonRecoverableError builds a NonRecoverableError, optionally capturing the call stack.

type NotificationEvent

type NotificationEvent struct {
	// ID audit event ID (subscribers dedupe on this — production is at-least-once)
	ID string `json:"id" validate:"required"`
	// EventType system event type
	EventType SystemEventTypeENUM `json:"type" validate:"required,system_event_type"`
	// CreatedAt when the audit event was recorded
	CreatedAt time.Time `json:"created_at"`
	// Creator opaque identity of the event's creator, when the event has one
	Creator *string `json:"creator,omitempty"`
	// SubjectType type of the subject the event is about (e.g. "task"), when derivable
	SubjectType *string `json:"subject_type,omitempty"`
	// SubjectID ID of the subject the event is about, when derivable
	SubjectID *string `json:"subject_id,omitempty"`
	// Metadata the event's typed metadata, as recorded on the audit row
	Metadata json.RawMessage `json:"metadata,omitempty"`
}

NotificationEvent the notification payload broadcast by the notification producer over Redis pub/sub. It is the full audit event (id, type, created_at, typed metadata) enriched with the derived routing keys (creator, subject). Serialized to JSON and carried as a goutilsRedis.QueueMessageEnvelope; subscribers deserialize it in their handler.

Optional routing keys are pointers so an absent creator/subject serializes as omitted rather than an ambiguous empty string.

func (NotificationEvent) ParseMetadata

func (e NotificationEvent) ParseMetadata(validator *validator.Validate) (interface{}, error)

ParseMetadata parse the event's metadata into its typed struct based on the event type, mirroring SystemEventAudit.ParseMetadata (they share the same underlying parser).

func (NotificationEvent) StringPayload

func (e NotificationEvent) StringPayload() (string, error)

StringPayload return its payload as a string; implements goutilsRedis.QueueMessageEnvelope

type NotificationProducerConfig

type NotificationProducerConfig struct {
	// PollIntervalSecs interval, in seconds, between audit-log polls
	PollIntervalSecs int `mapstructure:"pollIntervalSecs" json:"pollIntervalSecs" validate:"required,gte=1"`
	// BatchSize max number of un-broadcast events to process per poll
	BatchSize int `mapstructure:"batchSize" json:"batchSize" validate:"required,gte=1"`
	// EmitFirehose when true, publish every event on the `notify:all` firehose channel
	EmitFirehose bool `mapstructure:"emitFirehose" json:"emitFirehose"`
	// EmitTypeChan when true, publish every event on its `notify:type:<type>` channel
	EmitTypeChan bool `mapstructure:"emitTypeChan" json:"emitTypeChan"`
	// EmitCreator when true, publish creator-bearing events on their `notify:creator:<creator>`
	// and `notify:creator:<creator>:type:<type>` channels
	EmitCreator bool `mapstructure:"emitCreator" json:"emitCreator"`
}

NotificationProducerConfig config for the notification producer, the component that polls the audit log for un-broadcast events and publishes them over Redis pub/sub channels.

func (NotificationProducerConfig) PollInterval

func (c NotificationProducerConfig) PollInterval() time.Duration

PollInterval convert PollIntervalSecs to duration

type NotifyConsumerError

type NotifyConsumerError struct{ goutils.BaseError }

NotifyConsumerError error operating the notification consumer component: both the machinery (subscription setup, lifecycle start/stop) and the deliver path (deserializing a received pub/sub payload into a NotificationEvent before invoking the caller's callback). Wraps the underlying cause (e.g. RedisError, ConsistencyError) as Core.

func NewNotifyConsumerError

func NewNotifyConsumerError(message string, core error, getCallStack bool) NotifyConsumerError

NewNotifyConsumerError builds a NotifyConsumerError, optionally capturing the call stack.

type NotifyProducerError

type NotifyProducerError struct{ goutils.BaseError }

NotifyProducerError error operating the notification producer component: both the machinery (validator/timer setup, lifecycle start/stop) and the poll→publish→stamp loop (audit-log polling, channel routing, pub/sub publishing, broadcast stamping). Wraps the underlying cause (e.g. PersistenceError, RedisError, ConsistencyError) as Core.

func NewNotifyProducerError

func NewNotifyProducerError(message string, core error, getCallStack bool) NotifyProducerError

NewNotifyProducerError builds a NotifyProducerError, optionally capturing the call stack.

type OnFatalCB

type OnFatalCB func(reporter string, err error, timestamp time.Time)

OnFatalCB is invoked by a worker thread when it hits an unrecoverable fault, handing the decision of what to do about it (typically graceful shutdown) back to the parent application instead of terminating the process from inside a library goroutine.

reporter identifies the faulting thread; err carries the cause (its chain includes the code
position); timestamp is when the fault was detected.

type ProvisioningError

type ProvisioningError struct{ goutils.BaseError }

ProvisioningError encountered error when provisioning `tasking` component for use by embedding applications

func NewProvisioningError

func NewProvisioningError(message string, core error, getCallStack bool) ProvisioningError

NewProvisioningError build a ProvisioningError, optionally capturing the call stack.

type RetryParam

type RetryParam struct {
	// InitialDelaySec initial delay seconds
	InitialDelaySec int `mapstructure:"initDelaySec" json:"initDelaySec" validate:"gte=1"`
	// MaxRetries max number of retry allowed for failed execution. `-1` is infinite.
	MaxRetries int `mapstructure:"maxRetries" json:"maxRetries" validate:"gte=-1"`
	// MaxDelaySec max delay seconds
	MaxDelaySec *int `mapstructure:"maxDelaySec,omitempty" json:"maxDelaySec,omitempty" validate:"omitempty,gte=1"`
}

RetryParam retry parameters

type StepExecutionError

type StepExecutionError struct{ goutils.BaseError }

StepExecutionError error encountered while the Step Runner runs the WorkflowStepProcessor registered for a step's Type. It wraps the processor's returned error as Core so errors.As can still find any error the processor wrapped (including a NonRecoverableError). Potentially transient, so subject to the task engine's normal per-attempt retry.

func NewStepExecutionError

func NewStepExecutionError(message string, core error, getCallStack bool) StepExecutionError

NewStepExecutionError builds a StepExecutionError, optionally capturing the call stack.

type StepPreprocessError

type StepPreprocessError struct{ goutils.BaseError }

StepPreprocessError error encountered during workflow step execution pre-processing: the Step Runner's DB lookup of the workflow step or its parent workflow. Potentially transient (e.g. a failed DB read), so it is returned verbatim and left subject to the task engine's normal per-attempt retry - it is deliberately NOT wrapped in a NonRecoverableError.

func NewStepPreprocessError

func NewStepPreprocessError(message string, core error, getCallStack bool) StepPreprocessError

NewStepPreprocessError builds a StepPreprocessError, optionally capturing the call stack.

type SystemEventAudit

type SystemEventAudit struct {
	// ID audit entry ID
	ID string `json:"id" gorm:"column:id;primaryKey;unique" validate:"required"`
	// EventType system event type
	EventType SystemEventTypeENUM `json:"type" gorm:"column:type;not null" validate:"required,system_event_type"`
	// Metadata a metadata relating to the event
	Metadata datatypes.JSON `json:"metadata,omitempty" gorm:"column:metadata;default:null"`
	// CreatedAt entry creation timestamp
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt entry update timestamp
	UpdatedAt time.Time `json:"updated_at"`
	// BroadcastAt when the notification producer broadcast this event. NULL until
	// broadcast. The producer's work-queue marker: SELECT … WHERE broadcast_at IS NULL.
	BroadcastAt *time.Time `json:"broadcast_at,omitempty" gorm:"column:broadcast_at;index;default:null"`
}

SystemEventAudit recording of events occurring at the system level

func (SystemEventAudit) ParseMetadata

func (a SystemEventAudit) ParseMetadata(validator *validator.Validate) (interface{}, error)

ParseMetadata parse the metadata based on the event type

type SystemEventEngineFailedTask

type SystemEventEngineFailedTask struct {
	// TaskID ID of the task that was failed
	TaskID string `json:"task_id" validate:"required"`
	// InstanceID ID of the execution instance the engine failed to operate on
	InstanceID string `json:"instance_id" validate:"required"`
	// Reason human-readable reason the engine reported the failure
	Reason string `json:"reason"`
	// Creator opaque identity of the task's creator; the notification routing key.
	// Denormalized here so the producer can route from the audit row alone (no joins).
	Creator string `json:"creator" validate:"required"`
}

SystemEventEngineFailedTask records a task whose execution instance the core task engine failed to operate on (e.g. the receiver could not claim the instance, or could not submit it to the executor). This is an engine-level failure, distinct from a failure during actual task execution. The parent application is responsible for reviewing these.

type SystemEventInvalidTaskIPCMessage

type SystemEventInvalidTaskIPCMessage struct {
	// Receiver name of the IPC message receiver that rejected the message (e.g. "scheduler"
	// for the scheduler; the worker's config.Name for a task Receiver)
	Receiver string `json:"receiver" validate:"required"`
	// RawMessage the raw message payload as received, if it was readable
	RawMessage string `json:"raw_message"`
	// Reason human-readable reason the message was rejected
	Reason string `json:"reason"`
}

SystemEventInvalidTaskIPCMessage records a task IPC message an IPC receiver got but could not process (unreadable, unparsable, or of an unsupported/unknown type). The parent application is responsible for reviewing these.

type SystemEventTaskEvents

type SystemEventTaskEvents struct {
	// TaskID task ID
	TaskID string `json:"task_id" validate:"required"`
	// Creator opaque identity of the task's creator; the notification routing key.
	// Denormalized here so the producer can route from the audit row alone (no joins).
	Creator string `json:"creator" validate:"required"`
}

SystemEventTaskEvents system task related system event

type SystemEventTypeENUM

type SystemEventTypeENUM string

SystemEventTypeENUM system event type ENUM value type

const (
	// SystemEventTypeActivateTask activated a system task
	SystemEventTypeActivateTask SystemEventTypeENUM = "ACTIVATE_TASK"
	// SystemEventTypeCompleteTask complete a system task
	SystemEventTypeCompleteTask SystemEventTypeENUM = "COMPLETE_TASK"
	// SystemEventTypeFailedTask failed a system task
	SystemEventTypeFailedTask SystemEventTypeENUM = "FAILED_TASK"
	// SystemEventTypeCancelledTask cancelled a system task
	SystemEventTypeCancelledTask SystemEventTypeENUM = "CANCELLED_TASK"
	// SystemEventTypeTimedOutTask timed out a system task
	SystemEventTypeTimedOutTask SystemEventTypeENUM = "TIMED_OUT_TASK"
	// SystemEventTypeDeleteTask deleted a system task
	SystemEventTypeDeleteTask SystemEventTypeENUM = "DELETE_TASK"
	// SystemEventTypeInvalidTaskIPCMessage a task IPC message could not be processed
	SystemEventTypeInvalidTaskIPCMessage SystemEventTypeENUM = "INVALID_TASK_IPC_MESSAGE"
	// SystemEventTypeEngineFailedTask the core task engine failed to operate on one of a
	// task's execution instances (e.g. the receiver could not claim it, or could not submit
	// it to the executor); distinct from a failure during actual task execution
	SystemEventTypeEngineFailedTask SystemEventTypeENUM = "ENGINE_FAILED_TASK"

	// SystemEventTypeDefineWorkflow defined a new workflow
	SystemEventTypeDefineWorkflow SystemEventTypeENUM = "DEFINE_WORKFLOW"
	// SystemEventTypeWorkflowRunning a workflow entered the running state
	SystemEventTypeWorkflowRunning SystemEventTypeENUM = "WORKFLOW_RUNNING"
	// SystemEventTypeWorkflowComplete a workflow completed
	SystemEventTypeWorkflowComplete SystemEventTypeENUM = "WORKFLOW_COMPLETE"
	// SystemEventTypeWorkflowFailed a workflow failed
	SystemEventTypeWorkflowFailed SystemEventTypeENUM = "WORKFLOW_FAILED"
	// SystemEventTypeWorkflowTimedOut a workflow timed out
	SystemEventTypeWorkflowTimedOut SystemEventTypeENUM = "WORKFLOW_TIMED_OUT"
	// SystemEventTypeWorkflowCancelling a workflow is being cancelled
	SystemEventTypeWorkflowCancelling SystemEventTypeENUM = "WORKFLOW_CANCELLING"
	// SystemEventTypeWorkflowCancelled a workflow is cancelled
	SystemEventTypeWorkflowCancelled SystemEventTypeENUM = "WORKFLOW_CANCELLED"
	// SystemEventTypeWorkflowDeadlineUpdate a workflow's deadline was updated
	SystemEventTypeWorkflowDeadlineUpdate SystemEventTypeENUM = "WORKFLOW_DEADLINE_UPDATE"
	// SystemEventTypeDeleteWorkflow deleted a workflow
	SystemEventTypeDeleteWorkflow SystemEventTypeENUM = "DELETE_WORKFLOW"

	// SystemEventTypeWorkflowStepDefined a workflow step was reverted to defined (revived)
	SystemEventTypeWorkflowStepDefined SystemEventTypeENUM = "WORKFLOW_STEP_DEFINED"
	// SystemEventTypeWorkflowStepPending a workflow step entered the pending state
	SystemEventTypeWorkflowStepPending SystemEventTypeENUM = "WORKFLOW_STEP_PENDING"
	// SystemEventTypeWorkflowStepRunning a workflow step entered the running state
	SystemEventTypeWorkflowStepRunning SystemEventTypeENUM = "WORKFLOW_STEP_RUNNING"
	// SystemEventTypeWorkflowStepComplete a workflow step completed
	SystemEventTypeWorkflowStepComplete SystemEventTypeENUM = "WORKFLOW_STEP_COMPLETE"
	// SystemEventTypeWorkflowStepFailed a workflow step failed
	SystemEventTypeWorkflowStepFailed SystemEventTypeENUM = "WORKFLOW_STEP_FAILED"
	// SystemEventTypeWorkflowStepTimedOut a workflow step timed out
	SystemEventTypeWorkflowStepTimedOut SystemEventTypeENUM = "WORKFLOW_STEP_TIMED_OUT"
	// SystemEventTypeWorkflowStepCancelling a workflow step is being cancelled
	SystemEventTypeWorkflowStepCancelling SystemEventTypeENUM = "WORKFLOW_STEP_CANCELLING"
	// SystemEventTypeWorkflowStepCancelled a workflow step is cancelled
	SystemEventTypeWorkflowStepCancelled SystemEventTypeENUM = "WORKFLOW_STEP_CANCELLED"
)

Various system event types which will be captured

func (SystemEventTypeENUM) Values

Values all valid SystemEventTypeENUM values

type SystemEventWorkflowEvents

type SystemEventWorkflowEvents struct {
	// WorkflowID workflow ID; also the notification subject (subject:workflow:<id>).
	WorkflowID string `json:"workflow_id" validate:"required"`
	// Creator opaque identity of the workflow's creator; the notification routing key.
	// Denormalized here so the producer can route from the audit row alone (no joins).
	Creator string `json:"creator" validate:"required"`
}

SystemEventWorkflowEvents workflow related system event

type SystemEventWorkflowStepEvents

type SystemEventWorkflowStepEvents struct {
	// StepID workflow step ID
	StepID string `json:"step_id" validate:"required"`
	// WorkflowID parent workflow ID; also the notification subject (subject:workflow:<id>).
	WorkflowID string `json:"workflow_id" validate:"required"`
	// Creator opaque identity of the parent workflow's creator; the notification routing key.
	// Denormalized here so the producer can route from the audit row alone (no joins).
	Creator string `json:"creator" validate:"required"`
}

SystemEventWorkflowStepEvents workflow step related system event. The event is about the parent workflow (subject:workflow:<workflow_id>), carrying the step ID for detail.

type Task

type Task struct {
	// ID task ID
	ID string `json:"id" gorm:"column:id;primaryKey;unique" validate:"required"`

	// TaskName name of the task being executed. This is used to locate the execution processor
	// for this task name
	TaskName string `json:"name" gorm:"column:name;not null" validate:"required"`

	// Creator opaque identity of the entity that created this task. Set by the
	// submitting Client. tasking never interprets it; multi-tenancy/isolation is
	// the embedding application's responsibility.
	Creator string `json:"creator" gorm:"column:creator;index" validate:"required"`

	// TaskScheduleClass execution scheduling class of the task
	TaskScheduleClass TaskScheduleClassENUM `json:"schedule_class" gorm:"column:schedule_class;not null" validate:"required,task_schedule_class"`

	// TaskState state of the task
	TaskState TaskStateENUM `json:"state" gorm:"column:state;not null" validate:"required,task_state"`

	// Parameters optional parameters needed for processing the task
	Parameters datatypes.JSON `json:"parameters,omitempty" gorm:"column:parameters;default:null"`

	// Metadata a metadata relating to the task
	Metadata datatypes.JSON `json:"metadata,omitempty" gorm:"column:metadata;default:null"`

	// TargetRunTime for scheduled one-shot tasks, when this task must run
	TargetRunTime *time.Time `json:"target_runtime,omitempty" gorm:"column:target_runtime;default:null"`

	// Deadline if specified, the task must be completed by this deadline
	Deadline *time.Time `json:"deadline,omitempty" gorm:"column:deadline;default:null"`

	// RetryParams retry parameters in case of failure
	RetryParams TaskRetryParameters `json:"retry_params" gorm:"column:retry_params;not null" validate:"required"`

	// CreatedAt entry creation timestamp
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt entry update timestamp
	UpdatedAt time.Time `json:"updated_at"`
}

Task performed by the system in the background

func (Task) HasReachedTerminalState

func (t Task) HasReachedTerminalState() bool

HasReachedTerminalState report whether this task has finished for good: its state admits no further transition, whatever happens. The question an application asks to know it can stop watching a task.

@returns true if the task has reached a terminal state

func (Task) ValidNextState

func (t Task) ValidNextState(newState TaskStateENUM) error

ValidNextState verify the task can transition to new state

type TaskClientConfig

type TaskClientConfig struct {
	// SchedulerQueue scheduler IPC queue name
	SchedulerQueue string `mapstructure:"schedulerQueue" json:"schedulerQueue" validate:"required"`
	// TaskQueues task execution queue configurations
	TaskQueues []TaskQueueConfig `mapstructure:"taskQueues,omitempty" json:"taskQueues,omitempty" validate:"omitempty,gte=1,dive"`
}

TaskClientConfig task client config

type TaskClientError

type TaskClientError struct{ goutils.BaseError }

TaskClientError error operating the task client: the public task-submission API the rest of the system uses to enqueue work with the scheduler. Distinct from the task engine's internal component errors. Wraps the underlying cause (e.g. PersistenceError, TaskQueueError) as Core.

func NewTaskClientError

func NewTaskClientError(message string, core error, getCallStack bool) TaskClientError

NewTaskClientError builds a TaskClientError, optionally capturing the call stack.

type TaskDefinition

type TaskDefinition struct {
	// TaskName task name
	TaskName string `mapstructure:"name" json:"name" validate:"required"`
	// Retry the retry parameters to apply to this task name
	Retry RetryParam `mapstructure:"retry" json:"retry" validate:"required"`
	// Processor the task execution processor for this task name. Behavior rather than data, so it
	// is excluded from serialization - the application supplies it in code, not in a config file.
	Processor TaskExecutionProcessor `mapstructure:"-" json:"-" validate:"required"`
}

TaskDefinition parameter needed to describe one task

type TaskExecution

type TaskExecution struct {
	// ID task execution instance ID
	ID string `json:"id" gorm:"column:id;primaryKey;unique" validate:"required"`

	// TaskID the parent task ID
	TaskID string `json:"task_id" gorm:"column:task_id;not null" validate:"required"`

	// ExecutionClass execution instance scheduling class
	ExecutionClass TaskExecutionClassENUM `json:"execution_class" gorm:"column:execution_class;not null" validate:"required,task_execute_class"`
	// ExecutionState execution instance state type
	ExecutionState TaskExecutionStateENUM `json:"state" gorm:"column:state;not null" validate:"required,task_execute_state"`

	// TerminalState the terminal state the execution instance reached before it was
	// finalized: one of Processed, Failed, or Cancelled. Nil until the instance ends.
	// Because every ended instance is moved to FINALIZED, `ExecutionState` alone can no
	// longer report the outcome; this field preserves it.
	TerminalState *TaskExecutionStateENUM `json:"terminal_state,omitempty" gorm:"column:terminal_state;default:null" validate:"omitempty,task_execute_state"`
	// TerminatedAt the timestamp when the execution instance reached its terminal state.
	// Nil until the instance ends.
	TerminatedAt *time.Time `json:"terminated_at,omitempty" gorm:"column:terminated_at;default:null"`

	// TargetEnqueueTime target time to enqueue instance for worker to pickup
	//
	// This can't dictate when the task will execute, rather when it will be queue to execute
	TargetEnqueueTime *time.Time `json:"execute_at,omitempty" gorm:"column:execute_at;default:null"`

	// ExecutionWorkerName the worker which acquired the execution instance for processing
	ExecutionWorkerName *string `json:"worker_name,omitempty" gorm:"column:worker_name;default:null;" validate:"omitempty"`

	// RetryParentExecutionID for retry type execution instance, the original
	// execution instance ID
	RetryParentExecutionID *string `json:"retry_parent_id,omitempty" gorm:"column:retry_parent_id;default:null;" validate:"omitempty"`

	// ErrorMessage in case of processing failure, the error message
	ErrorMessage *string `json:"error_msg,omitempty" gorm:"column:error_msg;default:null;" validate:"omitempty"`

	// FailureDisposition in case of processing failure, whether the failure is retryable. Nil
	// until the instance fails, and a nil value is treated as retryable. Set to NON_RETRYABLE
	// when a processor returned a NonRecoverableError, so the scheduler (and the maintenance
	// backstop, which reads this persisted value) skips the retry.
	FailureDisposition *TaskFailureDispositionENUM `` /* 130-byte string literal not displayed */

	// Deadline if specified, the execution instance must be completed by this deadline
	Deadline *time.Time `json:"deadline,omitempty" gorm:"column:deadline;default:null"`

	// CreatedAt entry creation timestamp
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt entry update timestamp
	UpdatedAt time.Time `json:"updated_at"`
}

TaskExecution one execution instances for a task. Workers are processing execution instances of tasks, not the tasks themselves.

This model is tracking several things * One-shot tasks - immediate execution instance * Scheduled tasks - pending execution instance * Periodic tasks - upcoming pending execution instance * Retry on failure - pending retry execution instance

Upon completion of one execution instance, the scheduler decides on the next step to take for each task.

func (TaskExecution) HasEnded

func (e TaskExecution) HasEnded() bool

HasEnded report whether this execution instance has already reached an outcome and is no longer live: it is at or past one of the parallel terminal-outcome states (Processed, Failed, or Cancelled). Unlike IsStateAtOrPast (which walks a single downstream chain), these three are separate branches of the graph, so "ended" is the union of being at or past any of them.

This is the idempotency basis for handlers whose precondition is "the instance is still live" - notably the timeout handler, which should no-op rather than error when an instance already completed, failed, or was cancelled by the time the timeout delivery arrives.

Weaker than HasReachedTerminalState: an instance which has ended can still transition (PROCESSED and FAILED both move on to FINALIZED). "Ended" is about the outcome being known; "terminal" is about the state machine having nowhere left to go.

@returns true if the instance has reached a terminal outcome

func (TaskExecution) HasReachedTerminalState

func (e TaskExecution) HasReachedTerminalState() bool

HasReachedTerminalState report whether this execution instance has finished for good: its state admits no further transition, whatever happens.

Distinct from HasEnded - see IsTerminal.

@returns true if the instance has reached a terminal state

func (TaskExecution) IsStateAtOrPast

func (e TaskExecution) IsStateAtOrPast(reference TaskExecutionStateENUM) bool

IsStateAtOrPast report whether this execution instance's current state is `reference` itself or a state reachable downstream of `reference` by following the transition graph forward.

This is the basis for idempotency guards in the scheduler handlers. A handler whose job is to drive an instance to some target state can call this to detect a redundant/racing delivery: if the instance is already at or past the handler's own precondition (or the state it would produce), the work is already done and the delivery is a safe no-op. A state that is strictly upstream of `reference` returns false, so a genuine out-of-order delivery is NOT masked and still surfaces (via the subsequent transition attempt) as a consistency error.

@param reference TaskExecutionStateENUM - the state to compare against
@returns true if the current state is `reference` or reachable downstream from it

func (TaskExecution) ValidNextState

func (e TaskExecution) ValidNextState(newState TaskExecutionStateENUM) error

ValidNextState verify the task execution can transition to new state

type TaskExecutionClassENUM

type TaskExecutionClassENUM string

TaskExecutionClassENUM task execution scheduling class ENUM value

const (
	// TaskExecutionClassImmediate execute task as soon as possible
	TaskExecutionClassImmediate TaskExecutionClassENUM = "IMMEDIATE_EXECUTION"
	// TaskExecutionClassScheduled execute task at around a target time
	TaskExecutionClassScheduled TaskExecutionClassENUM = "SCHEDULED_EXECUTION"
	// TaskExecutionClassRetry retry of previously failed execution instance at
	// around a target time
	TaskExecutionClassRetry TaskExecutionClassENUM = "RETRY_EXECUTION"
)

func (TaskExecutionClassENUM) Values

Values all valid TaskExecutionClassENUM values

type TaskExecutionError

type TaskExecutionError struct{ goutils.BaseError }

TaskExecutionError error encountered during task processing

func NewTaskExecutionError

func NewTaskExecutionError(message string, core error, getCallStack bool) TaskExecutionError

NewTaskExecutionError builds a TaskExecutionError, optionally capturing the call stack.

type TaskExecutionProcessor

type TaskExecutionProcessor interface {
	/*
		ProcessTaskExecution process a task specific to this processor

			@param ctx context.Context - execution context
			@param taskEntry Task - task entry
			@param executeEntry TaskExecution - task execution instance
	*/
	ProcessTaskExecution(ctx context.Context, taskEntry Task, executeEntry TaskExecution) error
}

TaskExecutionProcessor execution processor for a particular task name

type TaskExecutionStateENUM

type TaskExecutionStateENUM string

TaskExecutionStateENUM task execution state ENUM value

const (
	// TaskExecutionStateDefined execution instance is defined
	TaskExecutionStateDefined TaskExecutionStateENUM = "EXECUTION_DEFINED"
	// TaskExecutionStateScheduled execution instance scheduled for future run
	TaskExecutionStateScheduled TaskExecutionStateENUM = "EXECUTION_SCHEDULED"
	// TaskExecutionStateEnqueued execution instance enqueued for worker pickup
	TaskExecutionStateEnqueued TaskExecutionStateENUM = "EXECUTION_ENQUEUED"
	// TaskExecutionStateAcquired execution instance acquired by a worker
	TaskExecutionStateAcquired TaskExecutionStateENUM = "EXECUTION_ACQUIRED"
	// TaskExecutionStateProcessing execution instance being processed by a worker
	TaskExecutionStateProcessing TaskExecutionStateENUM = "EXECUTION_PROCESSING"
	// TaskExecutionStateProcessed execution instance processed successfully by a worker
	TaskExecutionStateProcessed TaskExecutionStateENUM = "EXECUTION_PROCESSED"
	// TaskExecutionStateFailed execution instance failed during execution
	TaskExecutionStateFailed TaskExecutionStateENUM = "EXECUTION_FAILED"
	// TaskExecutionStateFinalized the scheduler has decide what actions to take next
	// after the execution instance succeeded or failed.
	TaskExecutionStateFinalized TaskExecutionStateENUM = "EXECUTION_FINALIZED"
	// TaskExecutionStateCancelled the execution instance was cancelled
	TaskExecutionStateCancelled TaskExecutionStateENUM = "EXECUTION_CANCELLED"
)

func (TaskExecutionStateENUM) IsTerminal

func (s TaskExecutionStateENUM) IsTerminal() bool

IsTerminal report whether this execution state is terminal - the instance has finished and can never transition again, whatever happens. See models/state.go for the concept.

Distinct from HasEnded, which asks whether the instance reached an *outcome*: a PROCESSED or FAILED instance has ended but is not terminal, because it still transitions to FINALIZED.

@returns true if the state admits no further transition

func (TaskExecutionStateENUM) Values

Values all valid TaskExecutionStateENUM values

type TaskExecutorError

type TaskExecutorError struct{ goutils.BaseError }

TaskExecutorError error operating the task executor component machinery (worker-pool setup, execution instance submission, and shutdown), as opposed to errors encountered while processing an individual task execution instance.

func NewTaskExecutorError

func NewTaskExecutorError(message string, core error, getCallStack bool) TaskExecutorError

NewTaskExecutorError builds a TaskExecutorError, optionally capturing the call stack.

type TaskFailureDispositionENUM

type TaskFailureDispositionENUM string

TaskFailureDispositionENUM whether a failed task execution should be retried. It is set only on an execution that failed during processing; a nil disposition is treated as RETRYABLE.

const (
	// TaskFailureDispositionRetryable the failure may be retried per the task's retry policy
	TaskFailureDispositionRetryable TaskFailureDispositionENUM = "RETRYABLE"
	// TaskFailureDispositionNonRetryable the failure is permanent; the task must not be retried
	TaskFailureDispositionNonRetryable TaskFailureDispositionENUM = "NON_RETRYABLE"
)

func (TaskFailureDispositionENUM) Values

Values all valid TaskFailureDispositionENUM values

type TaskMaintenanceError

type TaskMaintenanceError struct{ goutils.BaseError }

TaskMaintenanceError error encountered during the scheduler's periodic maintenance sweep (performMaintenance). Used only by performMaintenance to wrap failures of the list-scan transactions and of the per-item handler calls it drives.

func NewTaskMaintenanceError

func NewTaskMaintenanceError(message string, core error, getCallStack bool) TaskMaintenanceError

NewTaskMaintenanceError builds a TaskMaintenanceError, optionally capturing the call stack.

type TaskParameterExecuteWorkflowStep

type TaskParameterExecuteWorkflowStep struct {
	// StepID the workflow step to execute
	StepID string `json:"step_id" validate:"required"`
}

TaskParameterExecuteWorkflowStep the task Parameters payload for a WorkflowExecutionTaskName (__EXECUTE_WORKFLOW_STEP__) task. It carries only the workflow step ID; the Step Runner loads the step (and derives its parent workflow from the step's WorkflowID) from this ID. This is Runner-owned plumbing set by the workflow scheduler - the application never authors or reads it.

This is distinct from WorkflowStep.Parameters / WorkflowStep.Metadata, which are opaque to the Runner and passed through untouched to the per-Type WorkflowStepProcessor.

func ParseTaskParameterExecuteWorkflowStep

func ParseTaskParameterExecuteWorkflowStep(
	raw datatypes.JSON, v *validator.Validate,
) (TaskParameterExecuteWorkflowStep, error)

ParseTaskParameterExecuteWorkflowStep parse and validate the task Parameters payload of a WorkflowExecutionTaskName task into a TaskParameterExecuteWorkflowStep.

@param raw datatypes.JSON - the raw task Parameters blob
@param v *validator.Validate - validator to check the parsed payload
@returns the parsed step-execution task parameter

type TaskPostprocessError

type TaskPostprocessError struct{ goutils.BaseError }

TaskPostprocessError error encountered during task post-processing

func NewTaskPostprocessError

func NewTaskPostprocessError(message string, core error, getCallStack bool) TaskPostprocessError

NewTaskPostprocessError builds a TaskPostprocessError, optionally capturing the call stack.

type TaskPreprocessError

type TaskPreprocessError struct{ goutils.BaseError }

TaskPreprocessError error encountered during task pre-processing

func NewTaskPreprocessError

func NewTaskPreprocessError(message string, core error, getCallStack bool) TaskPreprocessError

NewTaskPreprocessError builds a TaskPreprocessError, optionally capturing the call stack.

type TaskQueueConfig

type TaskQueueConfig struct {
	// Name of the task queue
	Name string `mapstructure:"name" json:"name" validate:"required"`
	// Workers number of workers to process tasks from the queue in parallel
	Workers int `mapstructure:"workers" json:"workers" validate:"required,gte=1"`
	// BufferRequests number of requests a receiver can locally buffer for execution
	BufferRequests int `mapstructure:"bufferRequests" json:"bufferRequests" validate:"required,gte=1"`
	// SupportedTasks list of tasks supported by the task queue
	SupportedTasks []TaskDefinition `mapstructure:"tasks" json:"tasks" validate:"required,gte=1,dive"`
}

TaskQueueConfig task execution queue, and the tasks it runs.

This one shape is embedded, unchanged, in TaskReceiverConfig, TaskSchedulerConfig and TaskClientConfig. Task-to-queue routing is the fabric all three components share - the scheduler pokes the queue configured for a task's name, and the receiver serving that queue picks the work up - so describing it once means an application cannot let the three descriptions drift apart.

The cost of sharing the shape is that each component carries fields it does not itself consume: Workers and BufferRequests are read only by the receiver, Processor only by the receiver, and Retry only by the client. They are required regardless, so a single config literal satisfies all three constructors. Trading a few unused fields for one authoritative task list is deliberate.

Queue names must be unique within a config, and task names must be unique across the whole config - not merely within a queue. A repeated name silently overwrites rather than merges, so it is rejected during validation; see validateTaskQueueNaming.

type TaskReceiverConfig

type TaskReceiverConfig struct {
	// Name of the task receiver
	Name string `mapstructure:"name" json:"name" validate:"required"`
	// TaskQueues task execution queue configurations
	TaskQueues []TaskQueueConfig `mapstructure:"taskQueues" json:"taskQueues" validate:"required,gte=1,dive"`
	// SchedulerQueue scheduler IPC queue name
	SchedulerQueue string `mapstructure:"schedulerQueue" json:"schedulerQueue" validate:"required"`
}

TaskReceiverConfig task receiver config

type TaskReceiverError

type TaskReceiverError struct{ goutils.BaseError }

TaskReceiverError error operating the task receiver component machinery (queue receiver/executor/sender setup, crash-recovery orchestration, IPC message dequeue, claim-ownership, and submission to the executor), as opposed to errors encountered while processing an individual task execution instance.

func NewTaskReceiverError

func NewTaskReceiverError(message string, core error, getCallStack bool) TaskReceiverError

NewTaskReceiverError builds a TaskReceiverError, optionally capturing the call stack.

type TaskRetryParameters

type TaskRetryParameters struct {
	// MaxRetries max number of retry allowed for failed execution. `-1` is infinite.
	MaxRetries int `json:"max_retries" validate:"gte=-1"`

	// InitialDelaySec initial delay seconds
	InitialDelaySec int `json:"initial_delay" validate:"gte=1"`

	// MaxDelaySec max delay seconds
	MaxDelaySec *int `json:"max_delay,omitempty" validate:"omitempty,gte=1"`

	// Factor multiplicative factor or base
	Factor float64 `json:"factor" validate:"gte=1"`
}

TaskRetryParameters task failure retry parameters

func DefaultTaskRetryParameters

func DefaultTaskRetryParameters() TaskRetryParameters

DefaultTaskRetryParameters get the default task retry parameters

func (TaskRetryParameters) InitialDelay

func (s TaskRetryParameters) InitialDelay() time.Duration

InitialDelay convert `InitialDelaySec` to time duration

func (TaskRetryParameters) MaxDelay

func (s TaskRetryParameters) MaxDelay() time.Duration

MaxDelay convert `MaxDelaySec` to time duration

func (TaskRetryParameters) NextDelay

func (s TaskRetryParameters) NextDelay(retry int) time.Duration

NextDelay returns the wait duration before the next retry.

`retry` is 0‑based (the first retry after the initial attempt has retry==0).

When `retry` >= MaxRetries (or no retries left), it returns 0, signalling that the caller should stop retrying.

@param retry int - the retry attempt to compute delay for
@returns - the wait duration

func (*TaskRetryParameters) Scan

func (s *TaskRetryParameters) Scan(value interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (TaskRetryParameters) Value

func (s TaskRetryParameters) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

type TaskScheduleClassENUM

type TaskScheduleClassENUM string

TaskScheduleClassENUM task schedule class ENUM value

const (
	// TaskScheduleClassImmediateOneShot one-shot task for immediate execution
	TaskScheduleClassImmediateOneShot TaskScheduleClassENUM = "IMMEDIATE_ONE_SHOT"
	// TaskScheduleClassScheduledOneShot one-shot task for scheduled future execution
	TaskScheduleClassScheduledOneShot TaskScheduleClassENUM = "SCHEDULED_ONE_SHOT"
)

func (TaskScheduleClassENUM) Values

Values all valid TaskScheduleClassENUM values

type TaskSchedulerConfig

type TaskSchedulerConfig struct {
	// MaintenanceTimerIntSecs maintenance timer interval in seconds
	MaintenanceTimerIntSecs int `mapstructure:"maintenanceTimerIntSecs" json:"maintenanceTimerIntSecs" validate:"required,gte=10"`
	// SchedulerQueue scheduler IPC queue name
	SchedulerQueue string `mapstructure:"schedulerQueue" json:"schedulerQueue" validate:"required"`
	// TaskQueues task execution queue configurations
	TaskQueues []TaskQueueConfig `mapstructure:"taskQueues" json:"taskQueues" validate:"required,gte=1,dive"`
}

TaskSchedulerConfig task scheduler config

func (TaskSchedulerConfig) MaintenanceTimerInt

func (c TaskSchedulerConfig) MaintenanceTimerInt() time.Duration

MaintenanceTimerInt convert MaintenanceTimerIntSecs to duration

type TaskSchedulerError

type TaskSchedulerError struct{ goutils.BaseError }

TaskSchedulerError error operating the task scheduler component: both the machinery (request-processor and maintenance-timer setup, handler registration, queue receiver/sender setup, worker/timer startup) and the per-task scheduling logic (processing pending/cancelled/timed-out tasks and execution-instance state transitions). Wraps the underlying cause (e.g. PersistenceError, ConsistencyError, TaskQueueError) as Core.

func NewTaskSchedulerError

func NewTaskSchedulerError(message string, core error, getCallStack bool) TaskSchedulerError

NewTaskSchedulerError builds a TaskSchedulerError, optionally capturing the call stack.

type TaskStateENUM

type TaskStateENUM string

TaskStateENUM task state ENUM value type

const (
	// TaskStatePending the task is initialized and await scheduling
	TaskStatePending TaskStateENUM = "PENDING"
	// TaskStateActive the task is active and will be executed
	TaskStateActive TaskStateENUM = "ACTIVE"
	// TaskStateComplete the task completed
	TaskStateComplete TaskStateENUM = "COMPLETE"
	// TaskStateFailed the task failed (e.g. exhausted all retry attempts)
	TaskStateFailed TaskStateENUM = "FAILED"
	// TaskStateCancelling the task await cancelling
	TaskStateCancelling TaskStateENUM = "CANCELLING"
	// TaskStateCancelled the task has been cancelled
	TaskStateCancelled TaskStateENUM = "CANCELLED"
	// TaskStateTimeout the task did not wrap up before a deadline
	TaskStateTimeout TaskStateENUM = "TIMED_OUT"
)

func (TaskStateENUM) IsTerminal

func (s TaskStateENUM) IsTerminal() bool

IsTerminal report whether this task state is terminal - the task has finished and can never transition again, whatever happens. See models/state.go for the concept.

@returns true if the state admits no further transition

func (TaskStateENUM) Values

func (TaskStateENUM) Values() []TaskStateENUM

Values all valid TaskStateENUM values

type Workflow

type Workflow struct {
	// ID workflow ID
	ID string `json:"id" gorm:"column:id;primaryKey;unique" validate:"required"`

	// Name of the workflow
	Name string `json:"name" gorm:"column:name;not null;" validate:"required"`

	// Creator opaque identity of the entity that created this workflow. Set by the
	// submitting Client. tasking never interprets it; it is the routing key for the
	// workflow's audit events and notifications, so a creator can subscribe to the
	// workflows they created. Multi-tenancy/isolation is the embedding application's
	// responsibility.
	Creator string `json:"creator" gorm:"column:creator;index" validate:"required"`

	// State state of the workflow
	State WorkflowStateENUM `json:"state" gorm:"column:state;not null" validate:"required,workflow_state"`

	// Metadata relating to the workflow
	Metadata datatypes.JSON `json:"metadata,omitempty" gorm:"column:metadata;default:null"`

	// Deadline the workflow must be completed by this deadline
	Deadline time.Time `json:"deadline" gorm:"column:deadline;not null" validate:"required"`

	// StartedAt when the workflow started
	StartedAt *time.Time `json:"started_at,omitempty" gorm:"column:started_at;default:null"`

	// StoppedAt when the workflow reached termination points (i.e. completed or cancelled)
	StoppedAt *time.Time `json:"stopped_at,omitempty" gorm:"column:stopped_at;default:null"`

	// CreatedAt entry creation timestamp
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt entry update timestamp
	UpdatedAt time.Time `json:"updated_at"`
}

Workflow long running multi-step workflow built on a DAG of steps

func (Workflow) HasReachedTerminalState

func (w Workflow) HasReachedTerminalState() bool

HasReachedTerminalState report whether this workflow has finished for good: its state admits no further transition, whatever happens. The question an application asks to know it can stop watching a workflow.

Note this is about the workflow's OWN state, not about whether its steps have drained - the separate "settled" predicate the scheduler uses to decide completion.

@returns true if the workflow has reached a terminal state

func (Workflow) ValidNextState

func (w Workflow) ValidNextState(newState WorkflowStateENUM) error

ValidNextState verify the workflow can transition to new state

type WorkflowClientConfig

type WorkflowClientConfig struct {
	// SchedulerQueue workflow scheduler IPC queue name
	SchedulerQueue string `mapstructure:"schedulerQueue" json:"schedulerQueue" validate:"required"`
}

WorkflowClientConfig workflow client config. The workflow client's only IPC target is the workflow scheduler's own queue (onto which it pokes Process/Revive/Cancel Workflow events), so unlike TaskClientConfig it carries no per-name retry settings - step retry is a per-step property carried in the workflow spec. Its SchedulerQueue must match the workflow scheduler's SchedulerQueue.

type WorkflowClientError

type WorkflowClientError struct{ goutils.BaseError }

WorkflowClientError error operating the workflow client: the public workflow submission / user-mutation API (define, revive, cancel) an embedding application uses to drive the workflow engine. Distinct from the workflow engine's internal WorkflowSchedulerError. Wraps the underlying cause (e.g. PersistenceError for a failed row write, IPCMessageQueueError for a lost scheduler poke) as Core, so callers can errors.As to distinguish "row not written" from "written but poke lost". Mirrors TaskClientError for the workflow engine.

func NewWorkflowClientError

func NewWorkflowClientError(message string, core error, getCallStack bool) WorkflowClientError

NewWorkflowClientError builds a WorkflowClientError, optionally capturing the call stack.

type WorkflowSchedulerConfig

type WorkflowSchedulerConfig struct {
	// MaintenanceTimerIntSecs maintenance timer interval in seconds
	MaintenanceTimerIntSecs int `mapstructure:"maintenanceTimerIntSecs" json:"maintenanceTimerIntSecs" validate:"required,gte=10"`
	// SchedulerQueue scheduler IPC queue name
	SchedulerQueue string `mapstructure:"schedulerQueue" json:"schedulerQueue" validate:"required"`
}

WorkflowSchedulerConfig workflow scheduler config. Mirrors TaskSchedulerConfig but has no task-name -> queue mappings: the workflow scheduler dispatches step tasks via the task client, not through its own execution-queue senders. Its SchedulerQueue is the workflow scheduler's own dedicated IPC queue, distinct from the task scheduler's SchedulerQueue.

func (WorkflowSchedulerConfig) MaintenanceTimerInt

func (c WorkflowSchedulerConfig) MaintenanceTimerInt() time.Duration

MaintenanceTimerInt convert MaintenanceTimerIntSecs to duration

type WorkflowSchedulerError

type WorkflowSchedulerError struct{ goutils.BaseError }

WorkflowSchedulerError error operating the workflow scheduler component: both the machinery (validator/timer setup, queue receiver/sender setup, lifecycle start/stop, IPC message parse/dispatch) and the per-event workflow/step state-transition logic. Wraps the underlying cause (e.g. PersistenceError, ConsistencyError, IPCMessageQueueError) as Core. Mirrors TaskSchedulerError for the workflow scheduler.

func NewWorkflowSchedulerError

func NewWorkflowSchedulerError(
	message string, core error, getCallStack bool,
) WorkflowSchedulerError

NewWorkflowSchedulerError builds a WorkflowSchedulerError, optionally capturing the call stack.

type WorkflowStateENUM

type WorkflowStateENUM string

WorkflowStateENUM workflow state ENUM value type

const (
	// WorkflowStatePending workflow is pending execution
	WorkflowStatePending WorkflowStateENUM = "PENDING"

	// WorkflowStateRunning workflow is running
	WorkflowStateRunning WorkflowStateENUM = "RUNNING"

	// WorkflowStateComplete workflow finished
	WorkflowStateComplete WorkflowStateENUM = "COMPLETE"

	// WorkflowStateFailed workflow failed. Once it reached a failed state, it can be brought
	// back to the running state to reattempt the failed step. Or the workflow can be cancelled.
	WorkflowStateFailed WorkflowStateENUM = "FAILED"

	// WorkflowStateTimedOut workflow failed to complete before deadline Once it reached a
	// timed out state, it can be brought
	// back to the running state to reattempt the failed step. Or the workflow can be cancelled.
	WorkflowStateTimedOut WorkflowStateENUM = "TIMED_OUT"

	// WorkflowStateCancelling workflow is being cancelled
	WorkflowStateCancelling WorkflowStateENUM = "CANCELLING"

	// WorkflowStateCancelled workflow is cancelled
	WorkflowStateCancelled WorkflowStateENUM = "CANCELLED"
)

func NonTerminalWorkflowStates

func NonTerminalWorkflowStates() []WorkflowStateENUM

NonTerminalWorkflowStates the workflow states which are not terminal, i.e. every workflow which may still move. Returned in `Values()` order as a fresh slice, for use as a query condition.

@returns the non-terminal workflow states

func (WorkflowStateENUM) IsTerminal

func (s WorkflowStateENUM) IsTerminal() bool

IsTerminal report whether this workflow state is terminal - the workflow has finished and can never transition again, whatever happens. See models/state.go for the concept.

Only COMPLETE and CANCELLED qualify. A FAILED or TIMED_OUT workflow makes no further progress on its own, but it is not terminal: it can still be revived or cancelled (see workflow/DESIGN.md "Terminal vs. non-terminal").

@returns true if the state admits no further transition

func (WorkflowStateENUM) Values

Values all valid WorkflowStateENUM values

type WorkflowStep

type WorkflowStep struct {
	// ID workflow step ID
	ID string `json:"id" gorm:"column:id;primaryKey;unique" validate:"required"`

	// Name of the workflow step.
	Name string `json:"name" gorm:"column:name;not null;index:unique_step_in_workflow,unique;" validate:"required"`

	// WorkflowID parent workflow ID
	WorkflowID string `json:"workflow_id" gorm:"column:workflow_id;not null;index:unique_step_in_workflow,unique;" validate:"required"`

	// Creator opaque identity of the entity that created the parent workflow. Denormalized
	// from the workflow so step audit events can route without a join. Set at definition.
	Creator string `json:"creator" gorm:"column:creator;index" validate:"required"`

	// Type workflow step type which indicates which processor should run the step
	Type string `json:"type" gorm:"column:type;not null" validate:"required"`

	// State state of the workflow step
	State WorkflowStepStateENUM `json:"state" gorm:"column:state;not null" validate:"required,workflow_step_state"`

	// UserRestarted whether the user has revived this step (pure metadata, not a state)
	UserRestarted bool `json:"user_restarted" gorm:"column:user_restarted;not null;default:false"`

	// Parents steps this step depends on
	Parents WorkflowStepParents `json:"parents" gorm:"column:parents;not null"`

	// Parameters optional parameters needed for processing the step
	Parameters datatypes.JSON `json:"parameters,omitempty" gorm:"column:parameters;default:null"`

	// Metadata a metadata relating to the workflow step
	Metadata datatypes.JSON `json:"metadata,omitempty" gorm:"column:metadata;default:null"`

	// RetryParams retry parameters in case of failure
	RetryParams TaskRetryParameters `json:"retry_params" gorm:"column:retry_params;not null" validate:"required"`

	// Deadline the workflow step must be completed by this deadline
	Deadline time.Time `json:"deadline" gorm:"column:deadline;not null" validate:"required"`

	// StartedAt when the workflow step started
	StartedAt *time.Time `json:"started_at,omitempty" gorm:"column:started_at;default:null"`

	// StoppedAt when the workflow step reached termination points (i.e. completed or cancelled)
	StoppedAt *time.Time `json:"stopped_at,omitempty" gorm:"column:stopped_at;default:null"`

	// CreatedAt entry creation timestamp
	CreatedAt time.Time `json:"created_at"`
	// UpdatedAt entry update timestamp
	UpdatedAt time.Time `json:"updated_at"`
}

WorkflowStep one step of a long running multi-step workflow

func (WorkflowStep) HasReachedTerminalState

func (s WorkflowStep) HasReachedTerminalState() bool

HasReachedTerminalState report whether this workflow step has finished for good: its state admits no further transition, whatever happens.

@returns true if the step has reached a terminal state

func (WorkflowStep) ValidNextState

func (s WorkflowStep) ValidNextState(newState WorkflowStepStateENUM) error

ValidNextState verify the workflow step can transition to new state

type WorkflowStepExecution

type WorkflowStepExecution struct {
	// Task the task which executed the workflow step
	Task Task `json:"task"`
	// Executions the execution attempts that task made, oldest first
	Executions []TaskExecution `json:"executions"`
}

WorkflowStepExecution one task's worth of a workflow step's execution history: the task the scheduler dispatched to run the step, and every execution attempt that task made.

A step links to one task per attempt at running it - its first run, plus one per user-initiated revive - and each of those tasks holds its own retry attempts as TaskExecution rows. Those tasks are stamped with the reserved WorkflowExecutionTaskCreator, so an application's own task.Client cannot see them; workflow.Client.GetWorkflowStep is the sanctioned window onto them.

type WorkflowStepParents

type WorkflowStepParents struct {
	// ParentStepNames name of the parent steps
	ParentStepNames []string `json:"parents,omitempty"`
}

WorkflowStepParents structure

func (*WorkflowStepParents) Scan

func (s *WorkflowStepParents) Scan(value interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (WorkflowStepParents) Value

func (s WorkflowStepParents) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

type WorkflowStepProcessor

type WorkflowStepProcessor interface {
	/*
		ProcessTaskExecution process a workflow step of a particular Type.

			@param ctx context.Context - execution context
			@param workflowEntry Workflow - workflow entry
			@param stepEntry WorkflowStep - workflow step entry
	*/
	ProcessWorkflowStep(ctx context.Context, workflowEntry Workflow, stepEntry WorkflowStep) error
}

WorkflowStepProcessor workflow step processor for a particular workflow step type

type WorkflowStepStateENUM

type WorkflowStepStateENUM string

WorkflowStepStateENUM workflow step state ENUM value type

const (
	// WorkflowStepStateDefined a newly defined workflow step
	WorkflowStepStateDefined WorkflowStepStateENUM = "DEFINED"

	// WorkflowStepStatePending workflow step is pending execution
	WorkflowStepStatePending WorkflowStepStateENUM = "PENDING"

	// WorkflowStepStateRunning workflow step is running
	WorkflowStepStateRunning WorkflowStepStateENUM = "RUNNING"

	// WorkflowStepStateComplete workflow step finished
	WorkflowStepStateComplete WorkflowStepStateENUM = "COMPLETE"

	// WorkflowStepStateFailed workflow step failed. Once it reached a failed state, it can
	// be retried, or cancelled along with the rest of workflow.
	WorkflowStepStateFailed WorkflowStepStateENUM = "FAILED"

	// WorkflowStepStateTimedOut workflow step failed to complete before deadline. Once it reached
	// a timed out state, it can be retried, or cancelled along with the rest of workflow.
	WorkflowStepStateTimedOut WorkflowStepStateENUM = "TIMED_OUT"

	// WorkflowStepStateCancelling workflow step being cancelled
	WorkflowStepStateCancelling WorkflowStepStateENUM = "CANCELLING"

	// WorkflowStepStateCancelled workflow step being cancelled
	WorkflowStepStateCancelled WorkflowStepStateENUM = "CANCELLED"
)

func NonTerminalWorkflowStepStates

func NonTerminalWorkflowStepStates() []WorkflowStepStateENUM

NonTerminalWorkflowStepStates the workflow step states which are not terminal, i.e. every step which may still move. Returned in `Values()` order as a fresh slice, for use as a query condition.

@returns the non-terminal workflow step states

func (WorkflowStepStateENUM) IsTerminal

func (s WorkflowStepStateENUM) IsTerminal() bool

IsTerminal report whether this workflow step state is terminal - the step has finished and can never transition again, whatever happens. See models/state.go for the concept.

Only COMPLETE and CANCELLED qualify. A FAILED or TIMED_OUT step takes no further step on its own and counts as "done draining" for the scheduler's settle and dispatch decisions, but it is not terminal: a user revive reverts it to DEFINED (see workflow/DESIGN.md "Terminal vs. non-terminal").

@returns true if the state admits no further transition

func (WorkflowStepStateENUM) Values

Values all valid WorkflowStepStateENUM values

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL