/** * Parquet conversion worker — runs the DuckDB step of compaction in a * SHORT-LIVED CHILD PROCESS, spawned per conversion by the compactor * ({@link ./compactor.ts}) and exiting the moment it is done (ADR-0028). * * Why a child process (superseding ADR-0013's "no child process" for this one * step): the conversion is the only place the broker executes native code — * DuckDB's `@duckdb/node-api` binding and its `azure` extension. A fault in * that native code raises an uncatchable `SIGSEGV`; the compactor's * `try/catch` (which is meant to degrade to a JSONL-only archive) never runs, * and the whole host process dies. Embedding hosts that run many producers in * one process (plus unrelated app code) lose everything. Isolating just the * DuckDB call means a native crash is a non-zero child exit the parent maps * onto the existing null-Parquet fallback — the host stays up. * * The parent hands the child only the `az://` source/destination URLs, the * DuckDB `CREATE SECRET` body (a short-lived SAS, exactly as before), and the * memory/thread caps — all plain strings/numbers over IPC. The child never * sees the storage client, the OTEL SDK, or any Postgres pool, so the * serialisation costs ADR-0013 worried about do not apply here. Conversion * streams blob → blob through DuckDB's `azure` extension; no data file touches * the local disk. * * Protocol: parent sends one {@link ParquetJob} message; the child replies * with one {@link ParquetJobResult} and exits. A crash (signal / non-zero * exit with no reply) is the parent's cue to fall back. */ export type ParquetJob = { /** `az:///` of the sealed JSONL archive to read. */ readonly srcUrl: string; /** `az:///` of the Parquet blob to write. */ readonly dstUrl: string; /** Body of `CREATE OR REPLACE SECRET broker_storage (...)` — a short-lived SAS credential. */ readonly secretBody: string; /** DuckDB `memory_limit` for the conversion (bounds native memory in a cgroup). */ readonly memoryLimit: string; /** DuckDB `threads` for the conversion. */ readonly threads: number; /** * Offset ranges whose frames are not rows: invalid batches the JSONL archive * keeps verbatim (ADR-0030). Ranges, not batch ids, because a caller-supplied * id can repeat on a committed batch. */ readonly excludeOffsetRanges: readonly ParquetOffsetRange[]; }; /** An inclusive offset range, its bounds as decimal strings (bigints do not cross IPC). */ export type ParquetOffsetRange = { readonly first: string; readonly last: string; }; export type ParquetJobResult = { readonly ok: true; readonly rowCount: number; } | { readonly ok: false; readonly error: string; }; /** * The conversion itself. Exported so the parent's resolution logic and tests * can reference the module, but the real entry point is the IPC handler below. * Creates a fresh in-memory DuckDB, loads the `azure` extension, and streams * `read_json(src) → COPY → parquet(dst)`, verifying the row count. */ export declare function convertJsonlToParquet(job: ParquetJob): Promise; //# sourceMappingURL=parquet-worker.d.ts.map