Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type VarietyQueue ¶
type VarietyQueue struct {
// contains filtered or unexported fields
}
VarietyQueue is a queue that implements bucket based depth-first or breadth-first queue.
The breadth-first queues allow defining scores on whose basis the bucket is distributed. Lower scores are picked up first, and higher scores which have a greater chance of being just random noise are picked up later in depth first.
Depth-first queue uses a simple stack for LIFO operations and distributes items as they come in.
func New ¶
func New(queueType string) *VarietyQueue
New creates a new queue from the type specified.
func (*VarietyQueue) Len ¶
func (v *VarietyQueue) Len() int
Len returns the number of items in queue.
func (*VarietyQueue) Pop ¶
func (v *VarietyQueue) Pop() interface{}
Pop pops an element from the queue. Result can be nil if no more elements are present in the queue.
func (*VarietyQueue) Push ¶
func (v *VarietyQueue) Push(x interface{}, priority int)
Push pushes an element with an optional priority into the queue.