Documentation ¶
Overview ¶
Package queue provides a generic queue implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
type Clock interface { Now() time.Time After(d time.Duration) <-chan time.Time Sleep(d time.Duration) }
Clock is an interface that returns the current time and duration since a given time.
type DelayingQueue ¶
type DelayingQueue[T comparable] interface { Queue[T] // contains filtered or unexported methods }
DelayingQueue is a generic queue interface that supports adding items after
func NewDelayingQueue ¶
func NewDelayingQueue[T comparable](clock Clock) DelayingQueue[T]
NewDelayingQueue returns a new DelayingQueue.
type Queue ¶
type Queue[T any] interface { // Add adds an item to the queue. Add(item T) // Get returns an item from the queue. Get() (T, bool) // GetOrWait returns an item from the queue or waits until an item is added. GetOrWait() T // GetOrWaitWithDone returns an item from the queue or waits until an item is added or the done channel is closed. GetOrWaitWithDone(done <-chan struct{}) (T, bool) // Len returns the number of items in the queue. Len() int }
Queue is a generic queue interface.
type WeightDelayingQueue ¶ added in v0.5.0
type WeightDelayingQueue[T comparable] interface { Queue[T] // contains filtered or unexported methods }
WeightDelayingQueue is a generic weight delaying queue interface.
func NewWeightDelayingQueue ¶ added in v0.5.0
func NewWeightDelayingQueue[T comparable](clock Clock) WeightDelayingQueue[T]
NewWeightDelayingQueue returns a new WeightDelayingQueue.
type WeightQueue ¶ added in v0.5.0
WeightQueue is a generic weight queue interface.
func NewWeightQueue ¶ added in v0.5.0
func NewWeightQueue[T any]() WeightQueue[T]
NewWeightQueue returns a new WeightQueue.
Click to show internal directories.
Click to hide internal directories.