Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultCacheSize = 2000
DefaultCacheSize is the default amount of Queueable elements above the current height which are stored in the queue.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Indexable ¶ added in v0.108.0
type Indexable interface {
GetIndex() uint32
}
Indexable is an interface for an element that has an index.
type OperationMode ¶ added in v0.107.0
type OperationMode byte
OperationMode is the mode of operation for the queue. Could be either Blocking or NonBlocking.
const ( // NonBlocking means that Put will return immediately if the queue is full. NonBlocking OperationMode = 0 // Blocking means that Put will wait until there is enough space in the queue. Blocking OperationMode = 1 )
type Queue ¶
type Queue[Q Queueable] struct { // contains filtered or unexported fields }
Queue is the queue of queueable elements.
func New ¶
func New[Q Queueable](bc Queuer[Q], log *zap.Logger, relayer func(Q), cacheSize int, lenMetricsUpdater func(l int), mode OperationMode) *Queue[Q]
New creates an instance of Queue that handles Queueable elements.
func (*Queue[Q]) Discard ¶
func (bq *Queue[Q]) Discard()
Discard stops the queue and prevents it from accepting more elements to enqueue.
func (*Queue[Q]) LastQueued ¶
LastQueued returns the index of the last queued element and the queue's capacity left.
type Queueable ¶ added in v0.108.0
type Queueable interface { Indexable comparable }
Queueable is an interface for a queue element.
Click to show internal directories.
Click to hide internal directories.