/** * io/sync-client.ts * * Decode-worker side of the broker channel. The synchronous read path is * called from inside an Emscripten FS stream_ops.read while the WASM call is * on the stack: the thread posts a request message (delivery does not need * this thread's event loop) and parks in Atomics.wait until the broker * fills the SAB. Async RPCs (registration) are only used while unblocked. */ import type { IoConfig } from './protocol.js'; /** Error carrying an Emscripten-compatible errno for the FS layer. */ export declare class SyncIoError extends Error { readonly errno: number; constructor(errno: number, message: string); } /** Injectable so the blocking state machine is unit-testable in Node. */ export type WaitFn = (ctrl: Int32Array, index: number, value: number, timeoutMs: number) => 'ok' | 'not-equal' | 'timed-out'; export declare class SyncIo { private readonly port; private readonly config; private readonly wait; private readonly ctrl; private readonly data; private seq; private rpcId; private pendingRpcs; /** Per-worker L1 block cache (LRU via Map insertion order). */ private l1; constructor(port: MessagePort, sab: SharedArrayBuffer, config: IoConfig, wait?: WaitFn); get blockSize(): number; /** Register a remote URL with the broker; resolves with the file size. */ registerUrl(fileKey: string, url: string): Promise; /** * Hand local Files to the broker. Fire-and-forget: port messages are * delivered in order, so the registration always precedes the first read. */ registerFiles(files: Array<{ fileKey: string; file: File; size: number; }>): void; /** Drop the broker's references and cache for these files. */ release(fileKeys: string[]): void; /** * Synchronously read one block. Must only be called while this thread may * block (i.e. from inside an FS read) — no awaits anywhere on this path. */ readBlockSync(fileKey: string, blockIndex: number): Uint8Array; /** * Synchronous multi-block read into `out` at `outOffset`. Returns the * number of bytes written (clamped at EOF). */ readInto(fileKey: string, fileSize: number, position: number, length: number, out: Uint8Array, outOffset: number): number; private onReply; } //# sourceMappingURL=sync-client.d.ts.map