Documentation
¶
Overview ¶
Package async contains a set of helper objects for async tasks and job queues.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrTimeout happens when there's a timeout ... doh. ErrTimeout = errors.New("timeout") )
Functions ¶
func WithTimeout ¶
func WithTimeout(tm time.Duration, cb TimedCallback) (interface{}, error)
WithTimeout will execute the callback and return its value or a ErrTimeout if its execution will exceed the provided duration.
Types ¶
type Job ¶
type Job interface{}
Job is the generic interface object representing the data being pushed to the jobs queue and being passed to the workers.
type Logic ¶
type Logic func(arg Job)
Logic is the implementation of the logic each worker will execute.
type TimedCallback ¶
type TimedCallback func() interface{}
TimedCallback represents a generic function with a return value.
type WorkQueue ¶
type WorkQueue struct {
// contains filtered or unexported fields
}
WorkQueue is the object representing an async jobs queue with a given number of concurrent workers.
func NewBufferedQueue ¶ added in v1.11.0
Click to show internal directories.
Click to hide internal directories.