Documentation ¶
Index ¶
- type Flow
- func (f *Flow) AddSyncPoint(dependsOn ...*Task) *Task
- func (f *Flow) AddTask(function func() error, retryDuration time.Duration, dependsOn ...*Task) *Task
- func (f *Flow) AddTaskConditional(function func() error, retryDuration time.Duration, condition bool, ...) *Task
- func (f *Flow) Execute() *gardenv1beta1.LastError
- func (f *Flow) SetLogger(logger *logrus.Entry) *Flow
- func (f *Flow) SetProgressReporter(reporter func(int, string)) *Flow
- type Task
- type TaskList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flow ¶
type Flow struct { Name string Logger *logrus.Entry ProgressReporterFunc func(int, string) DoneCh chan *Task RootTasks TaskList ActiveTasks TaskList ErrornousTasks TaskList NumberOfExecutableTasks int NumberOfCompletedTasks int }
Flow is the definition of a flow.
func (*Flow) AddSyncPoint ¶
AddSyncPoint takes a list of tasks and returns a dummy task which can be used by others as dependency. With that, a long list of dependencies must only defined once.
func (*Flow) AddTask ¶
func (f *Flow) AddTask(function func() error, retryDuration time.Duration, dependsOn ...*Task) *Task
AddTask takes a <function> and a <retryDuration> and returns a pointer to a Task object.
func (*Flow) AddTaskConditional ¶
func (f *Flow) AddTaskConditional(function func() error, retryDuration time.Duration, condition bool, dependsOn ...*Task) *Task
AddTaskConditional takes a <function> and a <retryDuration> and returns a pointer to a Task object. In case the <condition> is false, the task will be marked as "skipped".
func (*Flow) Execute ¶
func (f *Flow) Execute() *gardenv1beta1.LastError
Execute will execute all tasks in the flow.
func (*Flow) SetLogger ¶
SetLogger will take a <logger> and store it on the Flow object. The logger will be used at the begin of each function invocation, and in case of errors.
func (*Flow) SetProgressReporter ¶
SetProgressReporter will take a function <reporter> and store it on the Flow object. The function will be called whenever the state changes. It will receive the percentage of compeleted tasks of the Flow and the list of currently executed functions as arguments.