import type { PathBuilder } from "path-ts"; import type { DuckDBLimits } from "#parquet/duckdb"; /** * The file one deletion applies to: a stored file by the path the manifest lists, * or every file of one source. */ export type DeletionTarget = { path: string; } | { source: string; }; /** * A sidecar parquet holding the deleted `source_id` values in a `source_id` column. */ export interface DeletionIDsFile { /** * The sidecar's path as the trainer reads it, under the version's Modal root. */ path: string; sha256: string; /** * The number of distinct `source_id` values the sidecar holds. */ ids: number; } /** * One entry of a version manifest's `deletions[]`. */ export interface CorpusDeletion { target: DeletionTarget; /** * The deleted ids, inline. * * A deletion holds this or {@linkcode source_ids_file}, never both. */ source_ids?: string[]; source_ids_file?: DeletionIDsFile; reason: string; /** * The issue that records the decision, as `#`. */ issue: string; /** * The rows of the target files whose `source_id` the set holds, per split, * counted when the version was assembled. */ rows_deleted: { train: number; val: number; test: number; }; } /** * What a caller asks to delete, before the assembler copies the sidecar and counts the rows. */ export interface DeletionRequest { target: DeletionTarget; sourceIDs?: readonly string[]; /** * A local sidecar parquet with a `source_id` column. */ sourceIDsFile?: string; reason: string; issue: string; } /** * The directory under a version's own directory that sidecar files are copied to. */ export declare const DELETIONS_DIRECTORY = "deletions"; /** * One deletion with its id set in memory and the manifest entry the assembler writes. */ export interface PreparedDeletion { deletion: Omit; ids: ReadonlySet; } /** * Read the distinct `source_id` values of a deletion sidecar. * * @throws When the file is missing, lacks the column, or a row's `source_id` isn't a non-empty string. */ export declare function readDeletionIDs(path: string, limits?: DuckDBLimits): Promise>; /** * Validate one request, copy its sidecar into the version directory, and load its id set. * * @throws When the request identifies no reason, an issue not spelled `#`, * both or neither of an inline list and a sidecar, or an empty set. */ export declare function prepareDeletion(request: DeletionRequest, versionDir: PathBuilder, modalRoot: string, limits?: DuckDBLimits): Promise; /** * Whether a deletion's target matches a manifest file. */ export declare function deletionTargets(target: DeletionTarget, file: { path: string; source?: string; }): boolean; /** * The `source_id` values of one parquet file that a set holds. */ export declare function matchedSourceIDs(localPath: string, ids: ReadonlySet, limits?: DuckDBLimits): Promise; /** * Read a JSON file of deletion requests, as the `overlay-manifest` command takes them. * * @throws When the file doesn't hold an array. */ export declare function readDeletionRequests(path: string): Promise; //# sourceMappingURL=deletions.d.ts.map