Skip to content

LossyQueue

Defined in: packages/data/src/queue/lossy-queue.ts:26

A FIFO queue that never throws or waits on an over-capacity enqueue, evicting the front (oldest) item — or skipping the incoming one — instead.

capacity has no default: an unbounded lossy queue can never fill up, so overflowPolicy would never apply, defeating the entire point of this type. A caller wanting an unbounded FIFO should use Queue.

T extends DefinedValue

The type of elements in the queue.

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

Defined in: packages/data/src/queue/lossy-queue.ts:31

Iterable<T, any, any> | undefined

LossyQueueOptions<T>

LossyQueue<T>

readonly capacity: number

Defined in: packages/data/src/queue/lossy-queue.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.

ILossyQueue.capacity


readonly overflowPolicy: OverflowPolicy

Defined in: packages/data/src/queue/lossy-queue.ts:29

Policy applied when the collection reaches its capacity.

ILossyQueue.overflowPolicy

[iterator](): Iterator<T>

Defined in: packages/data/src/queue/lossy-queue.ts:48

Iterator<T>

ILossyQueue.[iterator]


clear(): void

Defined in: packages/data/src/queue/lossy-queue.ts:52

Removes all elements from the collection.

void

ILossyQueue.clear


count(): number

Defined in: packages/data/src/queue/lossy-queue.ts:56

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

ILossyQueue.count


dequeue(): T | undefined

Defined in: packages/data/src/queue/lossy-queue.ts:100

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

T | undefined

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

ILossyQueue.dequeue


enqueue(item): readonly T[]

Defined in: packages/data/src/queue/lossy-queue.ts:60

Same as IQueue.enqueue, but never throws — returns the items dropped to make room (empty if nothing was dropped).

T

readonly T[]

IQueue.enqueue

ILossyQueue.enqueue


enqueueAll(items): readonly T[]

Defined in: packages/data/src/queue/lossy-queue.ts:76

Same as IQueue.enqueueAll, but never throws — returns the items dropped to make room (empty if nothing was dropped).

readonly T[]

readonly T[]

IQueue.enqueueAll

ILossyQueue.enqueueAll


front(): T | undefined

Defined in: packages/data/src/queue/lossy-queue.ts:104

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

T | undefined

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

ILossyQueue.front