import type { PathBuilder, PathBuilderLike } from "path-ts"; import { type WorkerBudget } from "#build/budget"; import { type ResolvedBuildSettings } from "#build/settings"; import type { BuildCorpusManifest, BuildCorpusOptions } from "#build/types"; import type { SourceRightsAdmission } from "#source-register/corpus-inputs"; import type { AdapterOptions, CorpusAdapter } from "#types"; /** * Canonical bytes per align range when the caller states none. * * A source smaller than this aligns in one task. * The 2026-10-20 profile aligned 14.6 M rows in 189 s, so a 2 GiB range of `usgov-nad`'s * rows takes minutes and a large source spreads over every worker. */ export declare const ALIGN_RANGE_BYTES: number; /** * What the coordinator needs from `buildCorpus`. */ export interface ParallelBuildContext { opts: BuildCorpusOptions; /** * The configured adapters, in the order a serial build drives them. */ adapters: readonly CorpusAdapter[]; skipped: string[]; settings: ResolvedBuildSettings; rights: SourceRightsAdmission; outputDir: PathBuilder; intermediateDir: PathBuilder; builtAt: string; budget: WorkerBudget; } /** * The number of align ranges for a canonical file of `bytes`: one per `rangeBytes`, * at most twice the job count. * * More ranges than workers lets a large source's ranges interleave with other sources' tasks, * and the cap keeps the per-process start cost below the work each range does. * The count changes which processes align which rows and never the bytes they write. */ export declare function alignRangeCount(bytes: number, rangeBytes: number, jobs: number): number; /** * Input rows per adapter partition. * * NAD's adapter reads about 14,700 rows a second on one core, so a partition * of this size runs in about 11 minutes. */ export declare const PARTITION_ROWS = 10000000; /** * The row ranges a source's adapter run is split into, or `null` to run it in one worker. * * A source splits when its adapter declares `inputRowCount`, no `limit` caps the run, * and its input holds more than one partition's rows. * A capped run stops at a count of the rows before it, and a partition can't know that count. */ export declare function partitionRanges(adapter: CorpusAdapter, options: AdapterOptions, partitionRows: number): Promise<{ start: number; end: number; }[] | null>; /** * Concatenate files in order into `destination`. * * One pipeline reads every source in order and writes the one write stream. * A pipeline per source with `end: false` leaves its four completion listeners on the * destination, so a build with more than ten sources tripped Node's max-listeners warning. */ export declare function concatenateFiles(sources: readonly string[], destination: PathBuilderLike): Promise; /** * Build every configured source in worker processes and assemble the corpus. */ export declare function runParallelBuild(ctx: ParallelBuildContext): Promise; //# sourceMappingURL=parallel.d.ts.map