Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue is an unbounded queue of jobs; enqueuing a job will always proceed, while dequeuing is done by receiving from a channel. It is also possible to iterate over the current list of jobs.
func (*Queue) Enqueue ¶
Enqueue puts a job onto the queue. It will block until the queue's loop can accept the job; but this does _not_ depend on a job being dequeued and will always proceed eventually.
func (*Queue) Len ¶
This is not guaranteed to be up-to-date; i.e., it is possible to receive from `q.Ready()` or enqueue an item, then see the same length as before, temporarily.
func (*Queue) Ready ¶
Ready returns a channel that can be used to dequeue items. Note that dequeuing is not atomic: you may still see the dequeued item with ForEach, for a time.
func (*Queue) Sync ¶
func (q *Queue) Sync()
Block until any previous operations have completed. Note that this is only meaningful if you are using the queue from a single other goroutine; i.e., it makes sense to do, say,
q.Enqueue(j) q.Sync() fmt.Printf("Queue length is %d\n", q.Len())
but only because those statements are sequential in a single thread. So this is really only useful for testing.
type Status ¶
type Status struct { Result event.CommitEventMetadata Err string StatusString StatusString }
Status holds the possible states of a job; either,
- queued or otherwise pending
- succeeded with a job-specific result
- failed, resulting in an error and possibly a job-specific result
type StatusCache ¶
type StatusCache struct { // Size is the number of statuses to store. When full, jobs are evicted in FIFO ordering. // oldest ones will be evicted to make room. Size int sync.RWMutex // contains filtered or unexported fields }
func (*StatusCache) SetStatus ¶
func (c *StatusCache) SetStatus(id ID, status Status)
type StatusString ¶
type StatusString string
const ( StatusQueued StatusString = "queued" StatusRunning StatusString = "running" StatusFailed StatusString = "failed" StatusSucceeded StatusString = "succeeded" )