跳转到内容
简体中文

StashBuffer

此内容尚不支持你的语言。

Defined in: src/typed/Behavior.ts:121

Lightweight stash interface handed to Behaviors.withStash factories.

Not a wrapper over context.stash() — it holds its own buffer, because stash(message) takes any value where the OO call can only park the message being handled, and because the capacity is declared per behavior where the cell’s is one default for the whole actor. It nonetheless gives the same guarantees the OO stash does: FIFO order, a capacity bound with a StashOverflowError past it, replay ahead of anything already queued, and dead letters for whatever is still parked when the actor stops or restarts (#639). The one thing it cannot reproduce is the original sender on those dead letters, since the buffer holds bare messages.

T

readonly isEmpty: boolean

Defined in: src/typed/Behavior.ts:131

True if the buffer holds any message.


readonly isFull: boolean

Defined in: src/typed/Behavior.ts:133

True if the buffer is at capacity.


readonly size: number

Defined in: src/typed/Behavior.ts:135

Current number of stashed messages.

stash(message): void

Defined in: src/typed/Behavior.ts:123

Stash the current message; must be called during a user message.

T

void


unstashAll(): void

Defined in: src/typed/Behavior.ts:129

Replay the buffered messages, prepended to the user mailbox in the order they were stashed — so they are handled before anything that was already queued when this was called. The buffer is empty afterwards.

void