BlockingQueue
Defined in: packages/data/src/queue/blocking-queue.ts:25
A FIFO queue that holds at most capacity items, and whose waitEnqueue
suspends until room frees up instead of throwing.
enqueue still throws — this type adds a way to wait, it does not change the
way to fail. A capacity of 0 is legal and never grants room: every
waitEnqueue blocks until a consumer is there to take the item, which is the
rendezvous semantics @ac-kit/async’s Channel is built on.
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 BlockingQueue<
T>(iterable,options):BlockingQueue<T>
Defined in: packages/data/src/queue/blocking-queue.ts:32
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<T, any, any> | undefined
options
Section titled “options”Returns
Section titled “Returns”BlockingQueue<T>
Properties
Section titled “Properties”capacity
Section titled “capacity”
readonlycapacity:number
Defined in: packages/data/src/queue/blocking-queue.ts:30
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/blocking-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/blocking-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/blocking-queue.ts:57
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/blocking-queue.ts:94
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/blocking-queue.ts:61
Adds an item to the rear of the queue.
Parameters
Section titled “Parameters”T
The item to add to the queue.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”enqueueAll()
Section titled “enqueueAll()”enqueueAll(
items):void
Defined in: packages/data/src/queue/blocking-queue.ts:66
Adds every item to the rear of the queue, in array order, so the last one is the last to be dequeued.
Parameters
Section titled “Parameters”readonly T[]
The items to add to the queue.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”front()
Section titled “front()”front():
T|undefined
Defined in: packages/data/src/queue/blocking-queue.ts:104
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.
Implementation of
Section titled “Implementation of”waitEnqueue()
Section titled “waitEnqueue()”waitEnqueue(
item,signal?):Promise<void>
Defined in: packages/data/src/queue/blocking-queue.ts:75
Same as enqueue, but waits for capacity if the operation would exceed it.
Parameters
Section titled “Parameters”T
signal?
Section titled “signal?”AbortSignal | null
Optional abort signal to cancel the operation.
Returns
Section titled “Returns”Promise<void>
IQueue.enqueue
Implementation of
Section titled “Implementation of”waitEnqueueAll()
Section titled “waitEnqueueAll()”waitEnqueueAll(
items,signal?):Promise<void>
Defined in: packages/data/src/queue/blocking-queue.ts:80
Same as enqueueAll, but waits for capacity if the operation would exceed
it. The whole batch lands at once, never interleaved with another
waiter’s.
Parameters
Section titled “Parameters”Iterable<T>
signal?
Section titled “signal?”AbortSignal | null
Optional abort signal to cancel the operation.
Returns
Section titled “Returns”Promise<void>
IQueue.enqueueAll