Documentation ¶
Overview ¶
In many cases such as restoring backups, tasks can be quite complex and should/can be broken down into smaller steps
Step is an utility structure that allows breaking down tasks complete with persist support
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Step ¶
type Step[T any] struct { State string // By default, steps of a lower index are ignored // Steps may however have an equal index in which case the step that is first in the array is first executed Index int // Exec will either return the task output which ends the task // or a task progress telling the new progress of the task // or an error to quickly abort the stepping // // After finishing the task Exec func( t *T, l *zap.Logger, state taskstate.TaskState, progstate taskstate.TaskProgressState, progress *taskstate.Progress, ) (*types.TaskOutput, *taskstate.Progress, error) }
type Stepper ¶
type Stepper[T any] struct { // contains filtered or unexported fields }
func NewStepper ¶
NewStepper creates a new stepper
func (*Stepper[T]) Exec ¶
func (s *Stepper[T]) Exec( task *T, l *zap.Logger, state taskstate.TaskState, progstate taskstate.TaskProgressState, ) (*types.TaskOutput, error)
Exec executes all steps, skipping over steps with a lower index
Click to show internal directories.
Click to hide internal directories.