Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInterruptedAddTask = errors.New("interrupted to add task") ErrFailedGetResult = errors.New("failed get result") ErrLastValueIsError = errors.New("last value is error") )
concurrency errors
Functions ¶
This section is empty.
Types ¶
type Repo ¶
type Repo interface {
// Invoke tasks: task must be functions
Invoke(tasks []interface{}) ([]Runner, error)
InvokeDuration(tasks []interface{}, timeout time.Duration) ([]Runner, error)
}
Repo functions for go routings to run tasks
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result run task return values
type Runner ¶
type Runner interface {
// get execute result
Get() *Result
// get execute result in duration
GetDuration(d time.Duration) (result *Result)
// judge runner is done
IsDone() bool
// judge runner is running
IsRunning() bool
// cancel runner
Cancel() bool
// is cancelled
IsCancelled() bool
// runner to run
Run()
}
Runner functions for a runner
type RunnerStack ¶
type RunnerStack struct {
// contains filtered or unexported fields
}
RunnerStack runner stack
func (*RunnerStack) PopAll ¶
func (p *RunnerStack) PopAll() (rs []Runner)
PopAll pop all runners from stack
type Task ¶
Task task
func (*Task) GetDuration ¶
GetDuration get result
func (*Task) IsCancelled ¶
IsCancelled judge a task if was cancelled return true
Click to show internal directories.
Click to hide internal directories.