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 Runner ¶
type Runner struct {
FailurePolicy FailurePolicy
OnProgress ProgressFunc
}
Runner executes a list of steps for a given stage.
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 StepResult ¶
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" )
Click to show internal directories.
Click to hide internal directories.