HttpStreamSession
Defined in: src/client/stream.ts:82
StreamSession implementation for the HTTP transport. Stream state is carried statelessly across requests via an HMAC state token: each HttpStreamSession.exchange or producer-continuation POST sends the current token and receives the next one in the response metadata.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new HttpStreamSession(opts): HttpStreamSession;Defined in: src/client/stream.ts:106
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
opts |
{ authorization?: string; baseUrl: string; callStateToken?: string | null; compressFn?: CompressFn; compressionLevel?: number; decompressFn?: DecompressFn; externalConfig?: ExternalLocationConfig; finished: boolean; header: Record<string, any> | null; inputSchema?: Schema<any>; method: string; onLog?: (msg) => void; outputSchema: Schema; pendingBatches: RecordBatch<any>[]; postFn?: PostFn; prefix: string; stateToken: string | null; } |
opts.authorization? |
string |
opts.baseUrl |
string |
opts.callStateToken? |
string | null |
opts.compressFn? |
CompressFn |
opts.compressionLevel? |
number |
opts.decompressFn? |
DecompressFn |
opts.externalConfig? |
ExternalLocationConfig |
opts.finished |
boolean |
opts.header |
Record<string, any> | null |
opts.inputSchema? |
Schema<any> |
opts.method |
string |
opts.onLog? |
(msg) => void |
opts.outputSchema |
Schema |
opts.pendingBatches |
RecordBatch<any>[] |
opts.postFn? |
PostFn |
opts.prefix |
string |
opts.stateToken |
string | null |
Returns
Section titled “Returns”HttpStreamSession
Accessors
Section titled “Accessors”header
Section titled “header”Get Signature
Section titled “Get Signature”get header(): Record<string, any> | null;Defined in: src/client/stream.ts:154
The stream’s one-time header row, or null if the method declares no header.
Returns
Section titled “Returns”Record<string, any> | null
The method’s header row (returned once at stream start), or null if the method declares no header.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”[asyncIterator]()
Section titled “[asyncIterator]()”asyncIterator: AsyncIterableIterator<Record<string, any>[]>;Defined in: src/client/stream.ts:317
Iterate over producer stream batches.
Returns
Section titled “Returns”AsyncIterableIterator<Record<string, any>[]>
Implementation of
Section titled “Implementation of”close()
Section titled “close()”close(): void;Defined in: src/client/stream.ts:495
No-op: the HTTP transport is stateless, so there is nothing to tear down.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”exchange()
Section titled “exchange()”exchange(input): Promise<Record<string, any>[]>;Defined in: src/client/stream.ts:211
Send an exchange request and return the data rows.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
Record<string, any>[] |
Returns
Section titled “Returns”Promise<Record<string, any>[]>
Implementation of
Section titled “Implementation of”nextWithToken()
Section titled “nextWithToken()”nextWithToken(): Promise<RowsWithToken | null>;Defined in: src/client/stream.ts:390
Read one producer batch and surface the worker’s continuation token.
Reads exactly one data batch and returns it paired with the resume token
that continues the stream AFTER that batch — the worker’s own serialized
producer state. A fresh session positioned at that token (see
HttpStreamSession.seekToToken / the client’s resumeStream)
resumes on any node, which is the basis for stateless, load-balanced
relays that must not pin a scan to one process.
Returns null at end-of-stream. Requires per-batch continuation tokens
(the default server behaviour — i.e. the worker is not configured with
max_response_bytes); throws if a single response carries more than one
data batch (coarser-than-batch resume is not representable here).
Drives the same wire protocol as async iteration but yields one
{ rows, token } per call instead of auto-following the token. Do not
interleave with iteration/exchange on the same session.
Mirrors Python’s HttpStreamSession.next_with_token.
Returns
Section titled “Returns”Promise<RowsWithToken | null>
seekToToken()
Section titled “seekToToken()”seekToToken(token): void;Defined in: src/client/stream.ts:464
Reposition a freshly-initialised session to resume from token.
Discards any init-preloaded batches and points the session at the given
resume token (as returned by HttpStreamSession.nextWithToken), so
the next nextWithToken() continues from exactly there. Used to resume a
scan on a new process/node — which is why the call token travels inside
the blob too: that node may never have seen this stream’s /init.
Mirrors Python’s seek_to_token.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
token |
string |
Returns
Section titled “Returns”void
