apply

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 3 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutionResult

type ExecutionResult struct {
	Prepare  StageResult
	Apply    StageResult
	Rollback StageResult
	Err      error
}

type FailurePolicy

type FailurePolicy int

FailurePolicy controls how the runner behaves when a step fails.

const (
	// StopOnError stops execution at the first failed step (default).
	StopOnError FailurePolicy = iota
	// ContinueOnError continues executing remaining steps, collecting all errors.
	ContinueOnError
)

type Orchestrator

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

func NewOrchestrator

func NewOrchestrator(policy RollbackPolicy, opts ...OrchestratorOption) *Orchestrator

func (*Orchestrator) Execute

func (o *Orchestrator) Execute(plan StagePlan) ExecutionResult

type OrchestratorOption

type OrchestratorOption func(*Orchestrator)

OrchestratorOption configures the orchestrator.

func WithFailurePolicy

func WithFailurePolicy(policy FailurePolicy) OrchestratorOption

WithFailurePolicy sets the failure policy for the apply stage runner.

func WithProgressFunc

func WithProgressFunc(fn ProgressFunc) OrchestratorOption

WithProgressFunc sets a callback that receives progress events during execution.

type ProgressEvent

type ProgressEvent struct {
	StepID string
	Stage  Stage
	Status StepStatus
	Err    error
}

ProgressEvent is emitted by the runner as each step starts and completes.

type ProgressFunc

type ProgressFunc func(ProgressEvent)

ProgressFunc is a callback invoked for every step lifecycle event.

type RollbackPolicy

type RollbackPolicy struct {
	OnApplyFailure bool
}

func DefaultRollbackPolicy

func DefaultRollbackPolicy() RollbackPolicy

func (RollbackPolicy) ShouldRollback

func (p RollbackPolicy) ShouldRollback(stage Stage, err error) bool

type RollbackStep

type RollbackStep interface {
	Step
	Rollback() error
}

type Runner

type Runner struct {
	FailurePolicy FailurePolicy
	OnProgress    ProgressFunc
}

Runner executes a list of steps for a given stage.

func (Runner) Run

func (r Runner) Run(stage Stage, steps []Step) StageResult

type Stage

type Stage string
const (
	StagePrepare  Stage = "prepare"
	StageApply    Stage = "apply"
	StageRollback Stage = "rollback"
)

type StagePlan

type StagePlan struct {
	Prepare []Step
	Apply   []Step
}

type StageResult

type StageResult struct {
	Stage   Stage
	Steps   []StepResult
	Success bool
	Err     error
}

func ExecuteRollback

func ExecuteRollback(steps []StepResult, stepIndex map[string]Step) StageResult

type Step

type Step interface {
	ID() string
	Run() error
}

type StepResult

type StepResult struct {
	StepID     string
	Status     StepStatus
	StartedAt  time.Time
	FinishedAt time.Time
	Err        error
}

type StepStatus

type StepStatus string
const (
	StepStatusPending    StepStatus = "pending"
	StepStatusRunning    StepStatus = "running"
	StepStatusSucceeded  StepStatus = "succeeded"
	StepStatusFailed     StepStatus = "failed"
	StepStatusRolledBack StepStatus = "rolled-back"
	StepStatusSkipped    StepStatus = "skipped"
)

Jump to

Keyboard shortcuts

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