flow

package
v0.1.0-dev.20260221092021 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(reg *execution.ActionRegistry)

Register registers all flow actions into the given registry.

Types

type Choose

type Choose struct{}

Choose is a conditional branch selector. It reads a boolean from its "when" slot and executes either the "then" or "else" phase.

Slots:

  • when: bool — condition (resolved from a predicate action's output)
  • then: string — phase ID to execute when true
  • else: string — phase ID to execute when false (optional)

Result: the selected branch phase's terminal node Result. UndoState: *chooseUndoState — the branch's recovery entries.

func (*Choose) Do

Do reads the boolean condition and executes the matching branch phase.

func (*Choose) Name

func (a *Choose) Name() string

Name returns the dotted action name.

func (*Choose) Undo

func (a *Choose) Undo(ctx *execution.Context, _ map[string]any, state execution.UndoState) error

Undo walks the selected branch's entries in reverse and calls CompensableAction.Undo.

type Elevate

type Elevate struct{}

Elevate is a privilege transition flow action. It marks the boundary between unprivileged and privileged execution as an explicit graph node. In dry-run mode it reports "root required here"; the receipt records when privilege was acquired and released.

func (*Elevate) Do

Do acquires elevated privilege. Stub implementation — full sudo/privilege integration is a separate plan.

func (*Elevate) Name

func (a *Elevate) Name() string

Name returns the dotted action name.

type Gather

type Gather struct{}

Gather is a parallel comprehension flow action. It executes a phase body once per item with configurable concurrency, collecting terminal results.

Slots:

  • items: []any — the list of items to iterate over
  • do: string — phase ID of the body to execute per item
  • limit: int — max concurrent iterations (default 1 = sequential)

Result: []any — terminal node Result from each iteration, in item order. UndoState: *GatherUndoState — per-iteration entries for rollback.

func (*Gather) Do

Do executes the referenced phase once per item, with per-iteration isolation.

func (*Gather) Name

func (a *Gather) Name() string

Name returns the dotted action name.

func (*Gather) Undo

func (a *Gather) Undo(ctx *execution.Context, _ map[string]any, state execution.UndoState) error

Undo walks iterations in reverse, re-resolves slots with saved proxy context, and calls Action.Undo per entry.

type PredicateFunc

type PredicateFunc func(any) (bool, error)

PredicateFunc is a re-evaluable condition for polling actions.

type WaitUntil

type WaitUntil struct{}

WaitUntil is an event-driven sensor — a synchronization primitive that pauses execution until a condition is satisfied or a timeout expires.

Slots:

  • target: any — the value to evaluate the predicate against (typically a promise)
  • predicate: PredicateFunc — condition to evaluate
  • timeout: string — maximum wait time (Go duration, e.g. "5m")
  • interval: string — poll interval (Go duration, default "5s")

Result: the target value when the predicate returns true. UndoState: nil — WaitUntil observes state but does not modify it.

func (*WaitUntil) Do

Do polls the predicate at the configured interval until it returns true or the timeout expires.

func (*WaitUntil) Name

func (a *WaitUntil) Name() string

Name returns the dotted action name.

Jump to

Keyboard shortcuts

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