Versions in this module Expand all Collapse all v0 v0.1.0 Oct 18, 2026 Changes in this version + var ErrCycle = errors.New("lifecycle: cycle") + var ErrDependencyFailed = errors.New("lifecycle: dependency failed") + var ErrDuplicatePhase = errors.New("lifecycle: duplicate phase") + var ErrIntegrity = errors.New("lifecycle: integrity check failed") + var ErrInvalidArtifact = errors.New("lifecycle: invalid artifact") + var ErrInvalidPhase = errors.New("lifecycle: invalid phase") + var ErrInvalidSnapshot = errors.New("lifecycle: invalid snapshot") + var ErrOwnershipLost = errors.New("lifecycle: run ownership lost") + var ErrPlanChanged = errors.New("lifecycle: plan changed") + var ErrRunOwned = errors.New("lifecycle: run is already owned") + var ErrRunTerminal = errors.New("lifecycle: run is terminal") + var ErrSnapshotNotFound = errors.New("lifecycle: snapshot not found") + var ErrUnknownDependency = errors.New("lifecycle: unknown dependency") + type Action func(context.Context) error + type Coordinator struct + func OpenCoordinator(ctx context.Context, topology *Topology, store Store, runID string, ...) (*Coordinator, error) + func (c *Coordinator) Close(ctx context.Context) error + func (c *Coordinator) EnterPhase(ctx context.Context, name string) (*Execution, error) + func (c *Coordinator) ExitPhase(ctx context.Context, name string) (*Execution, error) + func (c *Coordinator) RollbackPhase(ctx context.Context, name string) (*Execution, error) + func (c *Coordinator) Snapshot() Snapshot + type Engine struct + func NewEngine(plan *Plan, store Store, options Options) (*Engine, error) + func (e *Engine) Run(ctx context.Context, runID string) (result Snapshot, resultErr error) + type Execution struct + func (e *Execution) Complete(ctx context.Context, actionErr error) error + func (e *Execution) Context() context.Context + func (e *Execution) ShouldRun() bool + type Options struct + Clock func() time.Time + MaxParallel int + type Phase struct + DependsOn []string + Enter Action + Exit Action + Name string + Rollback Action + type PhaseSpec struct + DependsOn []string + Name string + type PhaseState struct + Attempts uint + LastError string + Status PhaseStatus + UpdatedAt time.Time + type PhaseStatus string + const PhaseEnterFailed + const PhaseEntered + const PhaseEntering + const PhaseExitFailed + const PhaseExited + const PhaseExiting + const PhaseFailed + const PhasePending + const PhaseRollbackFailed + const PhaseRolledBack + const PhaseRollingBack + type Plan struct + func NewPlan(phases []Phase) (*Plan, error) + func (p *Plan) Digest() string + func (p *Plan) Levels() [][]Phase + type RunStatus string + const RunFailed + const RunPending + const RunRolledBack + const RunRollingBack + const RunRunning + const RunSucceeded + type Session interface + Load func(context.Context) (Snapshot, error) + Release func(context.Context) error + RunID func() string + Save func(context.Context, Snapshot) error + type Snapshot struct + Phases map[string]PhaseState + PlanDigest string + RunID string + Status RunStatus + UpdatedAt time.Time + type Store interface + Acquire func(context.Context, string) (Session, error) + type Topology struct + func NewTopology(phases []PhaseSpec) (*Topology, error) + func (t *Topology) Digest() string + func (t *Topology) Levels() [][]PhaseSpec