RpcStreamBufferLedger class final

Bounds how many bytes one stream may hold un-consumed in a queue.

Separate from flow control, and deliberately so: the window paces DATA and metadata walks past it — sendMetadata spends no window and credit is returned on payload bytes only, both on purpose, because a control frame that cannot be sent deadlocks the stream it is ending. Measured in round 282: 4000 metadata frames, 32 MiB, none paced and no bound fired. So the limit here is a BUFFER bound, which is also how HTTP/2 bounds headers (SETTINGS_MAX_HEADER_LIST_SIZE, not the window).

Fails THE STREAM, never the connection: a peer flooding one call must not take down the others sharing the socket.

Constructors

RpcStreamBufferLedger({required int limitBytes, required int limitEvents, int? limitTotalBytes})
Creates a ledger admitting limitBytes and limitEvents per stream, and limitTotalBytes across all of them.

Properties

hashCode → int
The hash code for this object.
no setterinherited
limitBytes → int
Ceiling on un-consumed bytes held for a single stream.
final
limitEvents → int
Ceiling on un-consumed MESSAGES held for a single stream.
final
limitTotalBytes → int?
Ceiling on un-consumed bytes summed over every stream, or null for none.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
totalBytes → int
Un-consumed bytes held across all streams, for diagnostics and tests.
no setter
trackedStreams → int
How many streams hold a charge, for diagnostics and tests.
no setter

Methods

admit(int streamId, int bytes, {int events = 1}) → RpcBufferAdmission
Charges bytes and events messages against streamId.
chargeTotal(int bytes) → bool
Charges bytes held by another layer to the connection total only; false, and nothing charged, when they would cross it.
clear() → void
Drops every stream's state.
eventsFor(int streamId) → int
Un-consumed messages currently charged to streamId, for diagnostics and tests.
forget(int streamId) → void
Drops every trace of streamId; called when its call ends.
heldFor(int streamId) → int
Bytes currently charged to streamId, for diagnostics and tests.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
release(int streamId, int bytes, {int events = 1}) → void
Drops bytes and events messages of streamId's charge as its consumer takes them; events matches what admit was given.
releaseTotal(int bytes) → void
Returns bytes a chargeTotal took.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited