ctx

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWorkflowContextNotFound = errors.New("workflow context not found")

Functions

func WithWorkflowContext

func WithWorkflowContext(parent context.Context, wfCtx WorkflowContext) context.Context

WithWorkflowContext adds the workflowContext to a parent context

Types

type StatusPhase

type StatusPhase string
const (
	// PendingStatus The workflow/task has been initiated and is pending execution.
	PendingStatus StatusPhase = "pending"
	// RunningStatus The workflow/task is currently in progress.
	RunningStatus StatusPhase = "running"
	// WaitingStatus The workflow/task execution is temporarily paused, awaiting either inbound event(s) or a specified time interval as defined by a wait task.
	WaitingStatus StatusPhase = "waiting"
	// SuspendedStatus The workflow/task execution has been manually paused by a user and will remain halted until explicitly resumed.
	SuspendedStatus StatusPhase = "suspended"
	// CancelledStatus The workflow/task execution has been terminated before completion.
	CancelledStatus StatusPhase = "cancelled"
	// FaultedStatus The workflow/task execution has encountered an error.
	FaultedStatus StatusPhase = "faulted"
	// CompletedStatus The workflow/task ran to completion.
	CompletedStatus StatusPhase = "completed"
)

func (StatusPhase) String

func (s StatusPhase) String() string

type StatusPhaseLog

type StatusPhaseLog struct {
	Timestamp int64       `json:"timestamp"`
	Status    StatusPhase `json:"status"`
}

func NewStatusPhaseLog

func NewStatusPhaseLog(status StatusPhase) StatusPhaseLog

type WorkflowContext

type WorkflowContext interface {
	SetStartedAt(t time.Time)
	SetStatus(status StatusPhase)
	SetRawInput(input interface{})
	SetInstanceCtx(value interface{})
	GetInstanceCtx() interface{}
	SetInput(input interface{})
	GetInput() interface{}
	SetOutput(output interface{})
	GetOutput() interface{}
	GetOutputAsMap() map[string]interface{}
	GetVars() map[string]interface{}
	SetTaskStatus(task string, status StatusPhase)
	SetTaskRawInput(input interface{})
	SetTaskRawOutput(output interface{})
	SetTaskDef(task model.Task) error
	SetTaskStartedAt(startedAt time.Time)
	SetTaskName(name string)
	SetTaskReference(ref string)
	GetTaskReference() string
	ClearTaskContext()
	SetLocalExprVars(vars map[string]interface{})
	AddLocalExprVars(vars map[string]interface{})
	RemoveLocalExprVars(keys ...string)
	Clone() WorkflowContext
}

func GetWorkflowContext

func GetWorkflowContext(ctx context.Context) (WorkflowContext, error)

GetWorkflowContext retrieves the workflowContext from a context

func NewWorkflowContext

func NewWorkflowContext(workflow *model.Workflow) (WorkflowContext, error)

Jump to

Keyboard shortcuts

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