Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultPriority = 1
DefaultPriority is the default priority of tasks
View Source
var MaxRetries = 3
MaxRetries is the number of times a task will be attempted before it's marked "failed"
View Source
var NoVersion = "n/a"
NoVersion is used to denote non-versioned queues
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker interface { // Read returns a channel of incoming tasks Read(queue string, version string) (<-chan *Task, error) // Write returns a channel of outgoing tasks Write(queue string, version string) (chan<- *Task, error) // Stats returns current statistics of the broker (most likely just a bunch // of counters.) Stats() *Stats }
A Broker is used as the communication interface between the workers and queue-er
type Pool ¶
type Pool struct { Queue string Version string *sync.RWMutex // contains filtered or unexported fields }
A Pool is a set of workers that all function on the same queue
type Stats ¶
type Stats struct { Failures map[string]int `json:"failures"` Retries map[string]int `json:"retries"` Finished map[string]int `json:"finished"` Total map[string]int `json:"total"` }
Stats are the statistics unit that should be returned by a broker
type Task ¶
type Task struct { ID string `json:"id"` Retries int `json:"retries"` // CreatedAt CreatedAt time.Time `json:"created_at"` // WorkAt is the earliest this task can be worked WorkAt time.Time `json:"work_at"` Priority int `json:"priority"` Info interface{} `json:"info"` }
A Task contains information sent from the queue-er to the worker
func NewDelayedTask ¶
NewDelayedTask returns a task that will be worked after a certain time has elapsed
Click to show internal directories.
Click to hide internal directories.