queue

package
v0.0.0-...-1c5d739 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

type Queue interface {
	// Take pops an item off the head of the queue, waits indefinitely
	Take() interface{}

	// TakeChan pops an item off the head of the queue, waits time.Duration. If duration <0 waits indefinitely
	// Return chan interface for item in quey, and error chan for timeout
	TakeChan(time.Duration) (<-chan interface{}, <-chan error)

	// Poll removes item off the head of the queue, returns immediately. Returns item, bool is true if item was in
	// deque, false otherwise
	Poll() (interface{}, bool)

	// Put puts item in deque, waits indefinitely
	Put(item interface{})

	// Offer puts the item in queue. If successful return true, if queue is full return false
	Offer(item interface{}) bool

	//Returns the current number of items in the queue
	Size() int32

	//Returns the current number of items the queue can hold
	Capacity() int32
}

Queue is a bounded blocking queue

func NewChannelQueue

func NewChannelQueue(capacity int) (Queue, error)

NewChannelQueue creates a queue with a given capacity. If capacity <=0, error is returned

Jump to

Keyboard shortcuts

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