BoundedQueue
Defined in: packages/data/src/queue/bounded-queue.ts:30
A FIFO queue that holds at most capacity items and throws once full.
A fixed-size queue needs no class of its own — hand it a storage that already knows how big it is and the capacity follows:
new BoundedQueue(undefined, { storage: new RingVector(undefined, { capacity: 1024 }),});Type Parameters
Section titled “Type Parameters”T extends DefinedValue
The type of elements in the queue.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new BoundedQueue<
T>(iterable,options):BoundedQueue<T>
Defined in: packages/data/src/queue/bounded-queue.ts:36
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<T, any, any> | undefined
options
Section titled “options”Returns
Section titled “Returns”BoundedQueue<T>
Properties
Section titled “Properties”capacity
Section titled “capacity”
readonlycapacity:number
Defined in: packages/data/src/queue/bounded-queue.ts:34
The maximum number of elements the collection can hold.
Note: Infinity is not a legal value here — an unbounded type omits this
mixin.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”[iterator]()
Section titled “[iterator]()”[iterator]():
Iterator<T>
Defined in: packages/data/src/queue/bounded-queue.ts:46
Returns
Section titled “Returns”Iterator<T>
Implementation of
Section titled “Implementation of”clear()
Section titled “clear()”clear():
void
Defined in: packages/data/src/queue/bounded-queue.ts:50
Removes all elements from the collection.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”count()
Section titled “count()”count():
number
Defined in: packages/data/src/queue/bounded-queue.ts:54
The number of elements in the collection.
A method, not a getter: its async counterpart needs a round trip to the backing store, and a member must have the same shape in both.
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”dequeue()
Section titled “dequeue()”dequeue():
T|undefined
Defined in: packages/data/src/queue/bounded-queue.ts:85
Removes and returns the item at the front of the queue.
Returns
Section titled “Returns”T | undefined
The item at the front of the queue, or undefined if the queue is
empty.
Implementation of
Section titled “Implementation of”enqueue()
Section titled “enqueue()”enqueue(
item):void
Defined in: packages/data/src/queue/bounded-queue.ts:65
Same as IQueue.enqueue, but throws once the queue is full.
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”void
Throws
Section titled “Throws”If the operation would exceed the queue’s capacity.
IQueue.enqueue
Implementation of
Section titled “Implementation of”enqueueAll()
Section titled “enqueueAll()”enqueueAll(
items):void
Defined in: packages/data/src/queue/bounded-queue.ts:79
Same as IQueue.enqueueAll, but throws once the queue is full. Nothing is
added when it throws — the check is made against the whole batch.
Parameters
Section titled “Parameters”readonly T[]
Returns
Section titled “Returns”void
Throws
Section titled “Throws”If the operation would exceed the queue’s capacity.
IQueue.enqueueAll
Implementation of
Section titled “Implementation of”front()
Section titled “front()”front():
T|undefined
Defined in: packages/data/src/queue/bounded-queue.ts:89
Returns the item at the front of the queue without removing it.
Returns
Section titled “Returns”T | undefined
The item at the front of the queue, or undefined if the queue is
empty.