Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoundedQueue ¶
type BoundedQueue struct {
// contains filtered or unexported fields
}
BoundedQueue is a queue that has a specified size.
func NewBounded ¶
func NewBounded(size int) *BoundedQueue
New returns a new BoundedQueue with the specified buffer size. Size is forced to be greater than zero, will default to 1.
func (*BoundedQueue) Add ¶
func (q *BoundedQueue) Add(value interface{}) error
Push adds a node to the queue. Concurrency safe.
func (*BoundedQueue) Clear ¶
func (q *BoundedQueue) Clear()
Clear empties the queue and leaves it at a freshly initialized state. Not concurrency safe.
func (*BoundedQueue) Len ¶
func (q *BoundedQueue) Len() int
Len returns the length of the items in the queue. Concurrency safe.
func (*BoundedQueue) Take ¶
func (q *BoundedQueue) Take() interface{}
Take removes and returns a node from the queue in first to last order. Returns nil if there is nothing in the queue. Concurrency safe.
type UnboundedQueue ¶
type UnboundedQueue struct {
// contains filtered or unexported fields
}
Unbounded queue is a queue that can continuously be added to.
func NewUnbounded ¶
func NewUnbounded() *UnboundedQueue
New returns a new UnboundedQueue with the specified buffer size, must be greater than 1
func (*UnboundedQueue) Add ¶
func (q *UnboundedQueue) Add(value interface{}) error
Push adds a node to the queue. Not concurrency safe.
func (*UnboundedQueue) Clear ¶
func (q *UnboundedQueue) Clear()
Clear empties the queue and leaves it at a freshly initialized state. Not concurrency safe.
func (*UnboundedQueue) Len ¶
func (q *UnboundedQueue) Len() int
Len returns the length of the items in the queue. Not concurrency safe.
func (*UnboundedQueue) Take ¶
func (q *UnboundedQueue) Take() interface{}
Take removes and returns a node from the queue in first to last order. Returns nil if there is nothing in the queue. Not concurrency safe.