Documentation
¶
Overview ¶
Package prioqueue implements a priority queue using a heap-based implementation.
Items are ordered according to the Interface.Before method. The queue is a min-heap: items for which Before returns true come first. This means lower priority values (as defined by the Before implementation) are popped before higher values.
The heap keeps no arrival order between items Before does not order: of equal items, the last pushed may pop first. The daemon/runner breaks the ties with an arrival rank, for its items of equal priority to run in the order they were queued:
func (t Item) Before(other prioqueue.Interface) bool {
o := other.(Item)
if t.priority != o.priority {
return t.priority < o.priority
}
return t.seq < o.seq
}
Then an item of priority 1 pops before an item of priority 2, and of two items of priority 2, the one queued first pops first.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.