import type { PathBuilder } from "path-ts"; import type { BuildStage } from "#build/types"; import type { FileDerivation } from "#parquet/record"; import { type AdapterRunManifest } from "#runner"; import type { AdapterOptions, CorpusAdapter } from "#types"; export interface AdapterPhaseOptions { adapters: readonly CorpusAdapter[]; adapterInputs: Record; corpusVersion: string; intermediateDir: PathBuilder; /** * Each configured adapter's {@linkcode adapterRunInputs} digest. */ inputsFor: (adapterID: string) => Promise; /** * Reuse each adapter run a previous build finished rather than driving the adapter again. */ resume: boolean; onProgress?: (stage: BuildStage, message: string) => void; } export interface AdapterPhaseResult { /** * One manifest per adapter that ran or was reused, in the order they were driven. */ runs: AdapterRunManifest[]; /** * Adapter ids with no entry in `adapterInputs`. */ skipped: string[]; } /** * What a resumed build expects a reusable adapter run to have been made from. */ export interface AdapterRunIdentity { corpusVersion: string; /** * See {@linkcode adapterRunInputs}. */ inputs: string; } /** * The digest of what an adapter run's rows depend on: the adapter's options with * its input's fingerprint, and the code that wrote them. * * Both come from the source's derivation. * `adapterDerivations` computes it. */ export declare function adapterRunInputs(derivation: Pick): string; /** * Reuse a finished adapter run, or return `null` when this build has to drive the adapter. * * @throws When the run was made for another corpus version or from other inputs or code. * The align checkpoint records the adapter as aligned, so a run made again here * would leave the rows aligned from the old run in place. * @throws When the cached manifest and the file on disk disagree on the byte count. * The writer flushes the canonical file before writing the manifest. * Manifest presence establishes that the writer reached the end of its run. * The manifest describes the file as of that moment. * A truncated copy, an interrupted move or a partial transfer leaves the * manifest intact beside a shorter file. * The recorded byte count distinguishes those cases. * A resumed build that reuses a short file can produce a corpus whose row count later readers accept. */ export declare function reusableRun(adapterID: string, adapterDir: PathBuilder, expected: AdapterRunIdentity): Promise; /** * Drive every configured adapter, reusing whatever a previous build already finished. */ export declare function runAdapterPhase(opts: AdapterPhaseOptions): Promise; //# sourceMappingURL=adapters.d.ts.map