queue

package
v0.0.32 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item interface {
	GetID() interface{}
}

Item represents a queue item

type UniqueQueue

type UniqueQueue struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

UniqueQueue provides a queue that only allows unique items to be appended to it.

func NewUnique

func NewUnique() *UniqueQueue

NewUnique creates an instance of UniqueQueue

func (*UniqueQueue) Append

func (q *UniqueQueue) Append(i Item)

Append appends an item to the queue. If the item already exist, nothing is added.

func (*UniqueQueue) Empty

func (q *UniqueQueue) Empty() bool

Empty checks whether the queue is empty

func (*UniqueQueue) Has

func (q *UniqueQueue) Has(i Item) bool

Has checks whether a item exist in the queue

func (*UniqueQueue) Head

func (q *UniqueQueue) Head() Item

Head get an item from the head of the queue

func (*UniqueQueue) Size

func (q *UniqueQueue) Size() int

Size returns the size of the queue

Jump to

Keyboard shortcuts

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