queue

package
v3.10.5 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PriorityLow int = iota
	PriorityNormal
	PriorityHigh
	PriorityCritical
)

The priority levels for the priority Queue.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

type Queue struct {
	sync.Mutex
	Signal chan struct{}
	// contains filtered or unexported fields
}

Queue implements a FIFO data structure.

func NewQueue added in v3.9.0

func NewQueue() *Queue

NewQueue return an initialized Queue.

func (*Queue) Append

func (q *Queue) Append(data interface{})

Append adds the data to the Queue at priority level PriorityNormal.

func (*Queue) AppendPriority added in v3.9.0

func (q *Queue) AppendPriority(data interface{}, priority int)

AppendPriority adds the data to the Queue with respect to priority.

func (*Queue) Empty

func (q *Queue) Empty() bool

Empty returns true if the Queue is empty.

func (*Queue) Len

func (q *Queue) Len() int

Len returns the current length of the Queue

func (*Queue) Next

func (q *Queue) Next() (interface{}, bool)

Next returns the data at the front of the Queue.

func (*Queue) Process added in v3.9.0

func (q *Queue) Process(callback func(interface{}))

Process will execute the callback parameter for each element on the Queue.

func (*Queue) SendSignal added in v3.9.0

func (q *Queue) SendSignal()

SendSignal puts an element on the queue signal channel.

Jump to

Keyboard shortcuts

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