Skip to content

PriorityMailbox

Defined in: src/mailbox/PriorityMailbox.ts:20

User messages are dequeued in priority order (ascending priority value, then FIFO). System messages still take strict precedence over any user message. Internally backed by an ordered array — suitable for moderate mailbox sizes; swap for a heap if throughput becomes a concern.

  • Mailbox<T>

T = unknown

new PriorityMailbox<T>(settings): PriorityMailbox<T>

Defined in: src/mailbox/PriorityMailbox.ts:26

PriorityMailboxSettings<T>

PriorityMailbox<T>

Mailbox<T>.constructor

get size(): number

Defined in: src/mailbox/PriorityMailbox.ts:54

Number of pending user messages.

number

Mailbox.size


get suspended(): boolean

Defined in: src/internal/Mailbox.ts:34

boolean

Mailbox.suspended

dequeueSystem(): Envelope<unknown> | undefined

Defined in: src/internal/Mailbox.ts:54

Envelope<unknown> | undefined

Mailbox.dequeueSystem


dequeueUser(): Envelope<T> | undefined

Defined in: src/mailbox/PriorityMailbox.ts:49

Envelope<T> | undefined

Mailbox.dequeueUser


drainSystem(): Envelope<unknown>[]

Defined in: src/internal/Mailbox.ts:77

Envelope<unknown>[]

Mailbox.drainSystem


drainUser(): Envelope<T>[]

Defined in: src/mailbox/PriorityMailbox.ts:58

Drain all user messages; returns them so the caller can forward to dead letters.

Envelope<T>[]

Mailbox.drainUser


enqueue(env): void

Defined in: src/mailbox/PriorityMailbox.ts:31

Envelope<T>

void

Mailbox.enqueue


enqueueSystem(env): void

Defined in: src/internal/Mailbox.ts:45

Envelope<unknown>

void

Mailbox.enqueueSystem


hasMessages(): boolean

Defined in: src/mailbox/PriorityMailbox.ts:71

Peek at the next message that would be dequeued, without removing it.

boolean

Mailbox.hasMessages


hasSystemMessages(): boolean

Defined in: src/internal/Mailbox.ts:62

boolean

Mailbox.hasSystemMessages


hasUserMessages(): boolean

Defined in: src/mailbox/PriorityMailbox.ts:56

boolean

Mailbox.hasUserMessages


prependUser(envs): void

Defined in: src/mailbox/PriorityMailbox.ts:64

Put envelopes at the FRONT of the user queue, preserving their order.

Envelope<T>[]

void

Mailbox.prependUser


resume(): void

Defined in: src/internal/Mailbox.ts:68

void

Mailbox.resume


suspend(): void

Defined in: src/internal/Mailbox.ts:67

void

Mailbox.suspend