flow

package
v0.19.986 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirectiveContinue = "continue"
	DirectiveStop     = "stop"

	DirectiveAwaitApproval = "await-approval"

	DirectiveSkipGroup  = "skip-group"
	DirectiveRetry      = "retry"
	DirectiveRetryGroup = "retry-group"
)

Step directives tell the parent conductor how to proceed after a step completes.

View Source
const DirectiveKey = "directive"

DirectiveKey is the metadata key used to communicate step execution directives from the step workflow back to the parent conductor.

Variables

This section is empty.

Functions

func CompleteStepGeneration added in v0.19.903

func CompleteStepGeneration(ctx workflow.Context, cfg StepConfig, flw *app.Workflow, queueSignalID string) (*app.Workflow, error)

CompleteStepGeneration fetches and persists all remaining step groups after eager generation. Safe to call even if eager generation was not used (no-op).

func DispatchGroupSignal added in v0.19.894

func DispatchGroupSignal(ctx workflow.Context, cfg StepConfig, group *app.WorkflowStepGroup, flw *app.Workflow) (string, error)

DispatchGroupSignal enqueues an execute-workflow-step-group signal to the step queue and awaits its completion via the group-finished update handler. Returns the group's directive directly so the caller doesn't need to re-fetch from DB.

func DispatchGroupSignalByIdx added in v0.19.894

func DispatchGroupSignalByIdx(ctx workflow.Context, cfg StepConfig, groupIdx int, flw *app.Workflow, parallel bool) (string, error)

DispatchGroupSignalByIdx is a backward-compatible helper that dispatches a group signal using a GroupIdx and parallel flag directly, without a WorkflowStepGroup object.

func DispatchStepSignal added in v0.19.894

func DispatchStepSignal(ctx workflow.Context, cfg StepConfig, step *app.WorkflowStep, flw *app.Workflow) error

DispatchStepSignal enqueues the execute-workflow-step signal to the step queue. The signal runs the full step lifecycle in its own handler workflow.

func StepHumanDescription added in v0.19.894

func StepHumanDescription(err error) string

StepHumanDescription returns a user-facing error message for a failed step. For non-retryable application errors (validation failures, user errors), it extracts the root cause so the user sees actionable details. For transient/internal errors, it returns a generic message to avoid leaking internals.

Types

type ApprovalPauseErr added in v0.19.894

type ApprovalPauseErr struct {
	StepID string
}

ApprovalPauseErr indicates that execution stopped because a step is awaiting approval.

func NewApprovalPauseErr added in v0.19.894

func NewApprovalPauseErr(stepID string) *ApprovalPauseErr

func (*ApprovalPauseErr) Error added in v0.19.894

func (e *ApprovalPauseErr) Error() string

type ContinueAsNewErr

type ContinueAsNewErr struct {
	StartFromStepIdx int
}

ContinueAsNewErr signals that the workflow should continue-as-new from the given group/step index.

func NewContinueAsNewErr

func NewContinueAsNewErr(startsFromStepIdx int) *ContinueAsNewErr

func (*ContinueAsNewErr) Error

func (e *ContinueAsNewErr) Error() string

type EagerStepGroupsResult added in v0.19.903

type EagerStepGroupsResult struct {
	Workflow      *app.Workflow
	QueueSignalID string
}

EagerStepGroupsResult holds the result of an eager step generation — the eager groups are persisted and ready for execution, while remaining groups can be fetched later via CompleteStepGeneration.

func GenerateEagerStepGroups added in v0.19.903

func GenerateEagerStepGroups(ctx workflow.Context, cfg StepConfig, flw *app.Workflow) (*EagerStepGroupsResult, error)

GenerateEagerStepGroups generates and persists the eager step groups, allowing execution to begin on them while remaining groups are still generating.

type FlowStoppedErr added in v0.19.894

type FlowStoppedErr struct {
	StepID           string
	Reason           string
	RetriesExhausted bool
}

FlowStoppedErr is returned when a workflow is stopped due to a denial or skip-dependents response. Unlike ErrNotApproved, this carries context about why the flow stopped and signals to the execute-flow signal that it should not enter the retry-wait loop.

func NewFlowStoppedErr added in v0.19.894

func NewFlowStoppedErr(stepID, reason string) *FlowStoppedErr

func (*FlowStoppedErr) Error added in v0.19.894

func (e *FlowStoppedErr) Error() string

type StepConfig added in v0.19.894

type StepConfig struct {
	GroupQueueName         string
	QueueName              string
	TargetQueueName        string
	GenerateStepsQueueName string
	OwnerID                string
	OwnerType              string
	MW                     tmetrics.Writer
}

StepConfig holds the queue/owner configuration needed to dispatch and manage workflow steps. Used by both the execute-flow signal (directly) and the WorkflowConductor (for backward compatibility).

type WorkflowStepGenerator

type WorkflowStepGenerator func(ctx workflow.Context, uf *app.Workflow) (*app.GenerateStepsResult, error)

WorkflowStepGenerator is a function that generates workflow steps for a given workflow.

Directories

Path Synopsis
checks
Package directive defines typed directive constants for the workflow step and group execution system.
Package directive defines typed directive constants for the workflow step and group execution system.
signals

Jump to

Keyboard shortcuts

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