Skip to content

ExchangeRegistry

Defined in: packages/net-core/src/exchange-registry.ts:68

Matches inbound frames against outstanding requests.

This is the seam that decides what correlation strategies a protocol can express. Hard-coding “always the oldest request” — as a naive implementation does — silently rules out every protocol that answers out of order, so the strategy is pluggable from the start.

In

Key = unknown

readonly size: number

Defined in: packages/net-core/src/exchange-registry.ts:70

Number of exchanges currently outstanding, including tombstones.

offer(frame, body?): boolean

Defined in: packages/net-core/src/exchange-registry.ts:89

Offer an inbound frame to the outstanding exchanges.

In

The decoded frame.

ReadableStream<Uint8Array<ArrayBufferLike>>

Streamed payload declared by the codec, if any.

boolean

true if an exchange claimed the frame, false if it should be treated as unsolicited.


register(exchange, key?): void

Defined in: packages/net-core/src/exchange-registry.ts:79

Add an exchange to the set of candidates for inbound frames.

PendingExchange<In>

The exchange to track.

Key

Correlation key, for registries that match on one. Order-based registries ignore it.

void


rejectAll(error): void

Defined in: packages/net-core/src/exchange-registry.ts:103

Fail every outstanding exchange, for example when the connection drops.

unknown

The reason to reject with.

void


remove(exchange): void

Defined in: packages/net-core/src/exchange-registry.ts:96

Stop tracking an exchange without completing it.

PendingExchange<In>

The exchange to drop.

void