queue

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2022 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Type

type Type int

Type is the type of the queue to use.

const (
	BreadthFirst Type = iota
	DepthFirst
)

Types of queues available for selection.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL