Skip to content

IWaitablePriorityQueue

Defined in: packages/data/src/priority-queue/iwaitable-priority-queue.ts:11

The blocking sibling of IBoundedPriorityQueue: waits for capacity instead of throwing when the queue is full. The inherited insert still throws — this adds a way to wait, it does not change the way to fail.

T extends DefinedValue = DefinedValue

P = number

readonly capacity: number

Defined in: packages/data/src/collection/ibounded.ts:17

The maximum number of elements the collection can hold.

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

IBounded.capacity


readonly precedes: OrderPredicate<P>

Defined in: packages/data/src/priority-queue/ipriority-queue.ts:34

Strict weak ordering over priorities: precedes(a, b) means a outranks b.

IPriorityQueue.precedes

[iterator](): Iterator<T, any, any>

Defined in: node_modules/.store/typescript-npm-6.0.3-585eecd158/package/lib/lib.es2015.iterable.d.ts:47

Iterator<T, any, any>

IPriorityQueue.[iterator]


clear(): void

Defined in: packages/data/src/collection/icollection.ts:23

Removes all elements from the collection.

void

IPriorityQueue.clear


count(): number

Defined in: packages/data/src/collection/icollection.ts:20

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

IPriorityQueue.count


entries(): IterableIterator<PriorityEntry<T, P>>

Defined in: packages/data/src/priority-queue/ipriority-queue.ts:81

Every entry, in priority order (highest first).

IterableIterator<PriorityEntry<T, P>>

IPriorityQueue.entries


extract(): T | undefined

Defined in: packages/data/src/priority-queue/ipriority-queue.ts:59

Removes and returns the item with the highest priority from the priority queue.

T | undefined

The item with the highest priority, or undefined if the queue is empty.

IPriorityQueue.extract


insert(priority, item): void

Defined in: packages/data/src/priority-queue/ipriority-queue.ts:42

Inserts an item with its associated priority into the priority queue.

P

The priority of the item to insert.

T

The item to insert.

void

IPriorityQueue.insert


insertAll(priority, items): void

Defined in: packages/data/src/priority-queue/ipriority-queue.ts:50

Inserts every item at the same priority into the priority queue.

P

The priority shared by all the items to insert.

readonly T[]

The items to insert.

void

IPriorityQueue.insertAll


peek(): T | undefined

Defined in: packages/data/src/priority-queue/ipriority-queue.ts:68

Returns the item with the highest priority without removing it from the queue.

T | undefined

The item with the highest priority, or undefined if the queue is empty.

IPriorityQueue.peek


setPriority(item, priority): boolean

Defined in: packages/data/src/priority-queue/ipriority-queue.ts:78

Updates the priority of an existing item in the priority queue.

T

The item whose priority is to be updated.

P

The new priority of the item.

boolean

true if the item was found and its priority updated, false otherwise.

IPriorityQueue.setPriority


waitInsert(priority, item, signal?): Promise<void>

Defined in: packages/data/src/priority-queue/iwaitable-priority-queue.ts:22

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

P

T

AbortSignal | null

Optional abort signal to cancel the operation.

Promise<void>

IPriorityQueue.insert


waitInsertAll(priority, items, signal?): Promise<void>

Defined in: packages/data/src/priority-queue/iwaitable-priority-queue.ts:32

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

P

Iterable<T>

AbortSignal | null

Optional abort signal to cancel the operation.

Promise<void>

IPriorityQueue.insertAll