flowprotocol

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	context.Context

	// extendable error delay
	GetErrorDelay() time.Duration

	TaskId() string
	FatalError(error)

	// wraps goroutine spawning so that recovery is handled and properly logged
	Go(func())

	Sleep(time.Duration)

	GetSteps() []TaskStep

	CurrentStepIndex() int
	CurrentStep() TaskStep

	ReturnBasicStepSuccess() TaskStepResult
	ReturnSmallErrorf(format string, args ...any) TaskStepResult
	ReturnFatalErrorf(format string, args ...any) TaskStepResult

	Fatalf(format string, args ...any) error
}

type LifecycleHooks added in v0.3.27

type LifecycleHooks interface {
	// BeforeStep is called before executing a step. The step parameter is guaranteed to be non-nil and can be modified.
	BeforeStep(step *TaskStep) error
	// AfterStep is called after executing a step. the result parameter is guaranteed to be non-nil and can be modified.
	AfterStep(step TaskStep, result *TaskStepResult) error
}

type TaskStep

type TaskStep struct {
	// optional, will be inferred from the runtime function name if not provided
	Label    string
	StepFunc func() TaskStepResult

	// optional, all previous steps that dont have a grouping will be grouped together until another step with a grouping is reached
	StepGrouping string
}

func (TaskStep) GetStepLabel added in v0.3.5

func (step TaskStep) GetStepLabel() string

type TaskStepResult

type TaskStepResult struct {
	// label of the next TaskStep to execute (or terminate to stop the task), nil goes to next step in the flow if success
	NextStepLabel string
	Err           error
}

Jump to

Keyboard shortcuts

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