Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigFunc ¶
type ConfigFunc func(*executor)
ConfigFunc is a function used to initialize a new executor.
func WithBackoff ¶
func WithBackoff(backoff backoff.Backoff) ConfigFunc
WithBackoff sets the backoff strategy to use (default is an exponential strategy with a maximum of 30 seconds).
type Executor ¶
type Executor interface {
// Start will begin processing scheduled tasks. This method must not block.
Start()
// Schedule will put a task at the end of the processing queue. This method
// will block if Start has not been called, and must not be called after a
// call to Stop or Flush.
Schedule(task Task)
// Stop immediately drops the current task and exit the processing loop. This
// method does not attempt to interrupt the currently running task, but its
// return value will be ignored by the calling function.
Stop()
// Flush blocks until the queue has been completely processed. This method is
// the graceful version of Stop.
Flush()
}
Executor abstracts a sequence of tasks which are processed, in order, in a background goroutine. New tasks can be scheduled in a non-blocking manner.
func NewExecutor ¶
func NewExecutor(configs ...ConfigFunc) Executor
NewExecutor creates a new Executor.
