Versions in this module Expand all Collapse all v0 v0.2.1 Apr 12, 2023 Changes in this version type StepReport + FailureReason errors.EncodedError v0.2.0 Apr 5, 2023 Changes in this version + type AtomicStep interface + GetID func() string + type AtomicStepRegistry interface + BuildWorkflow func(id string, stepIDs StepIDs) (AtomicWorkflow, error) + GetStep func(id string) AtomicStep + RegisterSteps func(steps map[string]AtomicStep) AtomicStepRegistry + type AtomicWorkflow interface + End func(ctx context.Context) + GetID func() string + Start func(ctx context.Context) (WorkflowReport, error) + type Backward interface + Rollback func(ctx context.Context, prevFailure *Failure) (WorkflowReport, error) + type Choreographer interface + GetNext func() Forward + GetPrev func() Backward + SetNext func(next Forward) + SetPrev func(prev Backward) + type Failure struct + func NewFailedRollback(ctx context.Context, prevFailure *Failure, err error, report *StepReport) *Failure + func NewFailedRun(ctx context.Context, prevSuccess *Success, err error, report *StepReport) *Failure + func NewFailure(prevFailure *Failure, report *StepReport) *Failure + func NewSkippedRollback(prevFailure *Failure, report *StepReport) *Failure + type Forward interface + Run func(ctx context.Context, prevSuccess *Success) (WorkflowReport, error) + type SagaRun func(ctx context.Context) (skipped bool, err error) + type SagaUndo func(ctx context.Context) (skipped bool, err error) + type Status string + const StatusFailed + const StatusSkipped + const StatusSuccess + const StatusUndefined + type Step struct + ID string + Next Forward + Prev Backward + func (s *Step) FailedRollback(ctx context.Context, prevFailure *Failure, err error, report *StepReport) (WorkflowReport, error) + func (s *Step) GetID() string + func (s *Step) GetNext() Forward + func (s *Step) GetPrev() Backward + func (s *Step) RegisterSaga(run SagaRun, undo SagaUndo) *Step + func (s *Step) Rollback(ctx context.Context, prevFailure *Failure) (WorkflowReport, error) + func (s *Step) RollbackPrev(ctx context.Context, prevFailure *Failure, report *StepReport) (WorkflowReport, error) + func (s *Step) Run(ctx context.Context, prevSuccess *Success) (WorkflowReport, error) + func (s *Step) RunNext(ctx context.Context, prevSuccess *Success, report *StepReport) (WorkflowReport, error) + func (s *Step) SetNext(next Forward) + func (s *Step) SetPrev(prev Backward) + func (s *Step) SkippedRollback(ctx context.Context, prevFailure *Failure, report *StepReport) (WorkflowReport, error) + func (s *Step) SkippedRun(ctx context.Context, prevSuccess *Success, report *StepReport) (WorkflowReport, error) + type StepActionType string + const RollbackAction + const RunAction + type StepIDs []string + type StepRegistry struct + func NewStepRegistry(logger *zap.Logger) *StepRegistry + func (r *StepRegistry) BuildWorkflow(workflowID string, stepIDs StepIDs) (AtomicWorkflow, error) + func (r *StepRegistry) GetStep(id string) AtomicStep + func (r *StepRegistry) RegisterSteps(steps map[string]AtomicStep) AtomicStepRegistry + type StepReport struct + Action StepActionType + EndTime time.Time + Error errors.EncodedError + Metadata map[string][]byte + StartTime time.Time + Status Status + StepID string + func NewStepReport(id string, action StepActionType) *StepReport + type Success struct + func NewSkippedRun(prevSuccess *Success, report *StepReport) *Success + func NewStartTrigger(reports WorkflowReport) *Success + func NewSuccess(prevSuccess *Success, report *StepReport) *Success + type Workflow struct + func NewWorkflow(id string, opts ...WorkflowOption) *Workflow + func (wf *Workflow) End(ctx context.Context) + func (wf *Workflow) GetID() string + func (wf *Workflow) Start(ctx context.Context) (WorkflowReport, error) + type WorkflowOption func(wf *Workflow) + func WithLogger(logger *zap.Logger) WorkflowOption + func WithSteps(steps ...AtomicStep) WorkflowOption + type WorkflowReport struct + EndTime time.Time + StartTime time.Time + Status Status + StepReports []*StepReport + StepSequence StepIDs + WorkflowID string + func NewWorkflowReport(id string, steps StepIDs) *WorkflowReport + func (wfr *WorkflowReport) Append(stepReport *StepReport, action StepActionType, status Status)