Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Batch ¶
type Batch struct { // Precondition that needs to be satisfied before this batch will be // executed. // Can be a Time or Duration to indicate a time delay for batching. // Can be a chan that is satisfied when closed. // Can be nil for no precondition. Precondition interface{} // Key is used to batch together Tasks with the same key. Key interface{} // Priority is used to prioritize batches. // The larger numbers represent higher priorities. Priority int }
Batch describes the batching rules for a scheduled Task.
type Executable ¶
type Executable struct { Task Task // The work to be done. Cancelled task.Signal // Has this work been cancelled? Result Result // The result callback. }
Executable holds a task and it's result.
type Executor ¶
type Executor func(context.Context, []Executable, Batch)
Executor is the executor of Executables. The executor can only work on one list of Executables at a time.
type Result ¶
type Result func(val interface{}, err error)
Result is the result of an executed Task.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler schedules Tasks to Executors, batching where possible.
func (*Scheduler) NumTasksQueued ¶
NumTasksQueued returns the number of queued tasks.
Click to show internal directories.
Click to hide internal directories.