Documentation ¶
Index ¶
- func Execute(ctx context.Context, task Task) error
- func NewStack() *stack
- func NewTimeWheel(interval time.Duration, slotNum int) *timeWheel
- type Callback
- type Dag
- type DelayTask
- type Executor
- type FuncExecutor
- type NoneNotify
- type Notifier
- type Policy
- type RetryOption
- type State
- type Storage
- type Task
- type TaskOption
- type Vertex
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTimeWheel ¶ added in v1.0.1
Types ¶
type Dag ¶
type Dag struct { Vertexes []*Vertex // contains filtered or unexported fields }
Dag is directed acyclic graph
type FuncExecutor ¶ added in v1.0.1
type NoneNotify ¶
type NoneNotify struct { }
type RetryOption ¶ added in v1.0.1
type RetryOption func(*retryOption)
func WithAttempt ¶
func WithAttempt(attempt int) RetryOption
func WithInterval ¶
func WithInterval(interval time.Duration) RetryOption
func WithPolicy ¶
func WithPolicy(policy Policy) RetryOption
type Task ¶
type Task interface { ID() string Name() string State() (State, error) Description() string CreateTime() time.Time UpdateTime() time.Time Meta() map[string]interface{} Commit(ctx context.Context, opts ...TaskOption) error Rollback(ctx context.Context, opts ...TaskOption) error }
Task is library's minimum unit
func NewFuncTask ¶
func NewFuncTask(f func(context.Context) error, opts ...TaskOption) Task
func ParallelTask ¶
func ParallelTask(opts ...TaskOption) Task
func PipelineTask ¶
func PipelineTask(opts ...TaskOption) Task
func RetryTask ¶
func RetryTask(t Task, opts ...RetryOption) Task
type TaskOption ¶ added in v1.2.0
type TaskOption func(*taskOption)
func WithCallbacks ¶ added in v1.2.0
func WithCallbacks(callbacks ...Callback) TaskOption
func WithDescription ¶ added in v1.2.0
func WithDescription(description string) TaskOption
func WithMeta ¶ added in v1.2.0
func WithMeta(meta map[string]interface{}) TaskOption
func WithName ¶
func WithName(name string) TaskOption
func WithNowFunc ¶ added in v1.2.0
func WithNowFunc(nowFunc func() time.Time) TaskOption
func WithTasks ¶
func WithTasks(tasks ...Task) TaskOption
Click to show internal directories.
Click to hide internal directories.