storage

package
v0.0.0-...-bea47b1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const StaleStepThreshold = 5 * time.Minute

StaleStepThreshold is how long a RUNNING step may go without a heartbeat before another worker may reclaim it. Workers heartbeat well within this.

Variables

View Source
var ErrStepExists = errors.New("execution step already exists")

ErrStepExists is returned by CreateExecutionStep when a step with the same ID already exists. The engine uses deterministic step IDs for DAG nodes, so this error means another goroutine/worker already scheduled the node and the caller should treat creation as a no-op.

Functions

This section is empty.

Types

type ConditionalUpdater

type ConditionalUpdater interface {
	// UpdateExecutionStepIf writes step only if the stored step currently has
	// status from and, when worker is not empty, is owned by worker. It
	// returns false (and no error) when the condition does not hold.
	UpdateExecutionStepIf(ctx context.Context, namespace string, step *models.ExecutionStep, from models.TaskStatus, worker string) (bool, error)
	// UpdateExecutionIf writes exec only if the stored status is from.
	UpdateExecutionIf(ctx context.Context, namespace string, exec *models.Execution, from models.TaskStatus) (bool, error)
}

ConditionalUpdater is implemented by storages that support compare-and-set writes (all built-in backends). The engine uses it for every state transition so concurrent actors (two resume requests, a reclaimed zombie worker, the timeout reaper) cannot overwrite each other's results.

type Crypto

type Crypto struct {
	// contains filtered or unexported fields
}

Crypto handles AES-GCM encryption/decryption for sensitive data

func NewCrypto

func NewCrypto(keyHex string) (*Crypto, error)

func (*Crypto) Decrypt

func (c *Crypto) Decrypt(ciphertextHex string) (string, error)

func (*Crypto) Encrypt

func (c *Crypto) Encrypt(plaintext string) (string, error)

type ScheduleFilter

type ScheduleFilter struct {
	ActiveOnly bool
	Limit      int // 0 = no limit
	Offset     int
}

ScheduleFilter filters and paginates schedule listings.

type StepHeartbeater

type StepHeartbeater interface {
	HeartbeatStep(ctx context.Context, namespace, stepID, workerID string) (bool, error)
}

StepHeartbeater is optionally implemented by storages that support worker leases. Workers call HeartbeatStep periodically while a step runs so that long-running steps are not reclaimed and executed twice. It returns (false, nil) when the step is no longer owned by workerID.

type Storage

type Storage interface {
	SaveWorkflow(ctx context.Context, namespace string, wf *models.Workflow) error
	GetWorkflow(ctx context.Context, namespace string, id string) (*models.Workflow, error)
	ListWorkflows(ctx context.Context, namespace string) ([]*models.Workflow, error)

	CreateExecution(ctx context.Context, namespace string, exec *models.Execution) error
	GetExecution(ctx context.Context, namespace string, id string) (*models.Execution, error)
	UpdateExecution(ctx context.Context, namespace string, exec *models.Execution) error
	ListExecutions(ctx context.Context, namespace string) ([]*models.Execution, error)

	CreateExecutionStep(ctx context.Context, namespace string, step *models.ExecutionStep) error
	UpdateExecutionStep(ctx context.Context, namespace string, step *models.ExecutionStep) error
	GetExecutionSteps(ctx context.Context, namespace string, executionID string) ([]*models.ExecutionStep, error)

	ClaimReadyStep(ctx context.Context, namespace string, workerID string) (*models.ExecutionStep, error)

	ListWaitingSteps(ctx context.Context, namespace string, filter TaskFilter) ([]*models.ExecutionStep, error)
	GetExecutionStepByNode(ctx context.Context, namespace, executionID, nodeID string) (*models.ExecutionStep, error)

	AppendCompensationRecord(ctx context.Context, namespace string, rec *models.CompensationRecord) error
	ListCompensationRecords(ctx context.Context, namespace, executionID string) ([]*models.CompensationRecord, error)

	SaveSchedule(ctx context.Context, s *models.Schedule) error
	DeleteSchedule(ctx context.Context, namespace, id string) error
	GetActiveSchedules(ctx context.Context) ([]*models.Schedule, error)
	GetSchedule(ctx context.Context, namespace, id string) (*models.Schedule, error)
	ListSchedules(ctx context.Context, namespace string, filter ScheduleFilter) ([]*models.Schedule, error)
	TryClaimScheduleRun(ctx context.Context, namespace, id string, fireAt time.Time) (bool, error)
	RecordScheduleRun(ctx context.Context, namespace, id string, fireAt time.Time, execID, lastErr string, nextRun *time.Time) error
}

type TaskFilter

type TaskFilter struct {
	ExecutionID string
	Assignee    string
	NodeID      string
}

TaskFilter filters waiting / human task steps.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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