MCPcopy Create free account
hub / github.com/enriquebris/goconcurrentqueue / Queue

Interface Queue

queue.go:6–29  ·  view source on GitHub ↗

Queue interface with basic && common queue functions

Source from the content-addressed store, hash-verified

4
5// Queue interface with basic && common queue functions
6type Queue interface {
7 // Enqueue element
8 Enqueue(interface{}) error
9 // Dequeue element
10 Dequeue() (interface{}, error)
11 // DequeueOrWaitForNextElement dequeues an element (if exist) or waits until the next element gets enqueued and returns it.
12 // Multiple calls to DequeueOrWaitForNextElement() would enqueue multiple "listeners" for future enqueued elements.
13 DequeueOrWaitForNextElement() (interface{}, error)
14 // DequeueOrWaitForNextElementContext dequeues an element (if exist) or waits until the next element gets enqueued and returns it.
15 // Multiple calls to DequeueOrWaitForNextElementContext() would enqueue multiple "listeners" for future enqueued elements.
16 // When the passed context expires this function exits and returns the context' error
17 DequeueOrWaitForNextElementContext(context.Context) (interface{}, error)
18 // Get number of enqueued elements
19 GetLen() int
20 // Get queue's capacity
21 GetCap() int
22
23 // Lock the queue. No enqueue/dequeue/remove/get operations will be allowed after this point.
24 Lock()
25 // Unlock the queue.
26 Unlock()
27 // Return true whether the queue is locked
28 IsLocked() bool
29}

Implementers 2

FIFOfifo_queue.go
FixedFIFOfixed_fifo_queue.go

Calls

no outgoing calls

Tested by

no test coverage detected