Skip to content

BlockingDeque

Defined in: packages/data/src/deque/blocking-deque.ts:23

A double-ended queue that holds at most capacity items, and whose waitUnshift/waitPush suspend until room frees up instead of throwing.

unshift and push still throw — this type adds a way to wait, it does not change the way to fail.

T extends DefinedValue

The type of elements in the deque.

new BlockingDeque<T>(iterable, options): BlockingDeque<T>

Defined in: packages/data/src/deque/blocking-deque.ts:30

Iterable<T, any, any> | undefined

BlockingDequeOptions<T>

BlockingDeque<T>

readonly capacity: number

Defined in: packages/data/src/deque/blocking-deque.ts:28

The maximum number of elements the collection can hold.

Note: Infinity is not a legal value here — an unbounded type omits this mixin.

IWaitableDeque.capacity

[iterator](): Iterator<T>

Defined in: packages/data/src/deque/blocking-deque.ts:44

Iterator<T>

IWaitableDeque.[iterator]


back(): T | undefined

Defined in: packages/data/src/deque/blocking-deque.ts:156

Returns the item at the back of the deque without removing it.

T | undefined

The item at the back of the deque, or undefined if the deque is empty.

IWaitableDeque.back


clear(): void

Defined in: packages/data/src/deque/blocking-deque.ts:48

Removes all elements from the collection.

void

IWaitableDeque.clear


count(): number

Defined in: packages/data/src/deque/blocking-deque.ts:55

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.

number

IWaitableDeque.count


front(): T | undefined

Defined in: packages/data/src/deque/blocking-deque.ts:152

Returns the item at the front of the deque without removing it.

T | undefined

The item at the front of the deque, or undefined if the deque is empty.

IWaitableDeque.front


pop(): T | undefined

Defined in: packages/data/src/deque/blocking-deque.ts:142

Removes and returns the item at the back of the deque.

T | undefined

The item at the back of the deque, or undefined if the deque is empty.

IWaitableDeque.pop


push(item): void

Defined in: packages/data/src/deque/blocking-deque.ts:96

Adds an item to the back of the deque.

T

The item to add to the back of the deque.

void

IWaitableDeque.push


pushAll(items): void

Defined in: packages/data/src/deque/blocking-deque.ts:101

Adds every item to the back of the deque.

The items keep their relative order, so the last element of the array becomes the new back — Array.prototype.push semantics.

readonly T[]

The items to add to the back of the deque.

void

IWaitableDeque.pushAll


shift(): T | undefined

Defined in: packages/data/src/deque/blocking-deque.ts:132

Removes and returns the item at the front of the deque.

T | undefined

The item at the front of the deque, or undefined if the deque is empty.

IWaitableDeque.shift


unshift(item): void

Defined in: packages/data/src/deque/blocking-deque.ts:59

Adds an item to the front of the deque.

T

The item to add to the front of the deque.

void

IWaitableDeque.unshift


unshiftAll(items): void

Defined in: packages/data/src/deque/blocking-deque.ts:65

Adds every item to the front of the deque.

The items keep their relative order, so the first element of the array becomes the new front — Array.prototype.unshift semantics.

readonly T[]

The items to add to the front of the deque.

void

IWaitableDeque.unshiftAll


waitPush(item, signal?): Promise<void>

Defined in: packages/data/src/deque/blocking-deque.ts:111

Same as push, but waits for capacity if the operation would exceed it.

T

AbortSignal | null

Optional abort signal to cancel the operation.

Promise<void>

IDeque.push

IWaitableDeque.waitPush


waitPushAll(items, signal?): Promise<void>

Defined in: packages/data/src/deque/blocking-deque.ts:117

Same as pushAll, but waits for capacity if the operation would exceed it. The whole batch lands at once, never interleaved with another waiter’s.

Iterable<T>

AbortSignal | null

Optional abort signal to cancel the operation.

Promise<void>

IDeque.pushAll

IWaitableDeque.waitPushAll


waitUnshift(item, signal?): Promise<void>

Defined in: packages/data/src/deque/blocking-deque.ts:75

Same as unshift, but waits for capacity if the operation would exceed it.

T

AbortSignal | null

Optional abort signal to cancel the operation.

Promise<void>

IDeque.unshift

IWaitableDeque.waitUnshift


waitUnshiftAll(items, signal?): Promise<void>

Defined in: packages/data/src/deque/blocking-deque.ts:81

Same as unshiftAll, but waits for capacity if the operation would exceed it. The whole batch lands at once, never interleaved with another waiter’s.

Iterable<T>

AbortSignal | null

Optional abort signal to cancel the operation.

Promise<void>

IDeque.unshiftAll

IWaitableDeque.waitUnshiftAll