Documentation
¶
Index ¶
- Variables
- func NewFuncOptionWithArg[T any](opt FuncOptionWithArg[T], arg T) *funcOptionWithArg[T]
- func Register(typ string, creator FuncOptionCreator)
- func Verify(typ string, option string) error
- func WithDryRun(dryRun bool) taskOption
- func WithID(id string) taskOption
- func WithLogger(logger Logger) taskOption
- func WithName(name string) taskOption
- type Cache
- type FuncOption
- type FuncOptionCreator
- type FuncOptionWithArg
- type Logger
- type Option
- type Runner
- type State
- type Task
- type TaskFilterFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( StateName = map[State]string{ 0: "PENDING", 1: "RUNNING", 2: "SUCCEEDED", 3: "CANCELING", 4: "CANCELED", 5: "FAILED", } StateValue = map[string]State{ "PENDING": 0, "RUNNING": 1, "SUCCEEDED": 2, "CANCELING": 3, "CANCELED": 4, "FAILED": 5, } )
Functions ¶
func NewFuncOptionWithArg ¶
func NewFuncOptionWithArg[T any](opt FuncOptionWithArg[T], arg T) *funcOptionWithArg[T]
func Register ¶
func Register(typ string, creator FuncOptionCreator)
func WithDryRun ¶
func WithDryRun(dryRun bool) taskOption
func WithLogger ¶
func WithLogger(logger Logger) taskOption
Types ¶
type Cache ¶
type Cache[K comparable, V any] interface { Load(K) (V, bool) Store(K, V) Delete(K) Reset() Range(func(K, V) bool) Len() int }
func NewCache ¶
func NewCache[K comparable, V any]() Cache[K, V]
type FuncOption ¶
func NewFuncOption ¶
func NewFuncOption(typ string, option string) (FuncOption, error)
type FuncOptionCreator ¶
type FuncOptionCreator func() FuncOption
type FuncOptionWithArg ¶
type Logger ¶
type Runner ¶
type Runner interface {
Context() context.Context
Execute(Task)
Submit(string, func(Task) error, ...taskOption) Task
SubmitByOption(FuncOption, ...taskOption) Task
SubmitByTask(Task) Task
Get(string) (Task, bool)
GetAll(...func(Task) bool) []Task
Retry(string) error
RetryAll(...func(Task) bool)
Cancel(string) error
CancelAll(...func(Task) bool)
Remove(string) error
RemoveAll(...func(Task) bool)
}
type Task ¶
type Task interface {
Id() string
Name() string
Err() error
Log() string
State() State
Progress() float64
ProgressState() string
Children() []Task
StartTime() time.Time
EndTime() time.Time
DryRun() bool
Done() <-chan struct{}
Reset(context.Context)
Running() bool
Context() context.Context
Logger() Logger
Run()
Cancel()
SetName(string)
SetState(State)
SetProgress(float64)
SetProgressState(string)
}
type TaskFilterFunc ¶
Click to show internal directories.
Click to hide internal directories.