KeyedRegistry
Defined in: packages/net-core/src/keyed-registry.ts:26
Key-based ExchangeRegistry for protocols that answer out of order.
MQTT packet identifiers, JSON-RPC ids, DNS transaction identifiers, RTMP
transaction identifiers and AMQP channel identifiers all correlate this way,
and none of them can be served by an order-based registry: a response to the
third request may legitimately arrive first.
Type Parameters
Section titled “Type Parameters”In
Inbound frame type.
Key
Correlation key type, anything usable as a Map key.
Implements
Section titled “Implements”ExchangeRegistry<In,Key>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new KeyedRegistry<
In,Key>(options):KeyedRegistry<In,Key>
Defined in: packages/net-core/src/keyed-registry.ts:31
Parameters
Section titled “Parameters”options
Section titled “options”KeyedRegistryOptions<In, Key>
Returns
Section titled “Returns”KeyedRegistry<In, Key>
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get size():
number
Defined in: packages/net-core/src/keyed-registry.ts:35
Number of exchanges currently outstanding, including tombstones.
Returns
Section titled “Returns”number
Number of exchanges currently outstanding, including tombstones.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”offer()
Section titled “offer()”offer(
frame,body?):boolean
Defined in: packages/net-core/src/keyed-registry.ts:57
Offer an inbound frame to the outstanding exchanges.
Parameters
Section titled “Parameters”In
The decoded frame.
ReadableStream<Uint8Array<ArrayBufferLike>>
Streamed payload declared by the codec, if any.
Returns
Section titled “Returns”boolean
true if an exchange claimed the frame, false if it should be
treated as unsolicited.
Implementation of
Section titled “Implementation of”register()
Section titled “register()”register(
exchange,key?):void
Defined in: packages/net-core/src/keyed-registry.ts:47
Track an exchange under the key the peer will echo back.
Parameters
Section titled “Parameters”exchange
Section titled “exchange”PendingExchange<In>
The exchange awaiting a response.
Key
The correlation key.
Returns
Section titled “Returns”void
Throws
Section titled “Throws”If no key was supplied, since positional matching is not meaningful for a protocol that answers out of order.
Implementation of
Section titled “Implementation of”rejectAll()
Section titled “rejectAll()”rejectAll(
error):void
Defined in: packages/net-core/src/keyed-registry.ts:94
Fail every outstanding exchange, for example when the connection drops.
Parameters
Section titled “Parameters”Error
The reason to reject with.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”remove()
Section titled “remove()”remove(
exchange):void
Defined in: packages/net-core/src/keyed-registry.ts:85
Stop tracking an exchange without completing it.
Parameters
Section titled “Parameters”exchange
Section titled “exchange”PendingExchange<In>
The exchange to drop.
Returns
Section titled “Returns”void