/** How this machine compresses files in place: the filesystem the sessions live on. */ export type CompressMethod = "apfs" | "ntfs"; export interface CompressCandidate { path: string; bytes: number; /** Bytes allocated on disk before compression. */ allocated: number; mtimeMs: number; /** Identity at selection; a file that no longer matches is left alone. */ mtimeNs: bigint; ino: bigint; } export interface CompressBatchResult { compressed: number; /** Bytes allocated on disk by the processed candidates afterwards. */ allocatedAfter: number; errors: string[]; } /** * The compression method for files under `dir`, or undefined when the volume * holding it has no transparent compression this phase drives (exFAT, SMB, * NFS, ReFS, FAT, Linux filesystems, or a missing `dir`). */ export declare function compressMethod(dir: string, platform?: NodeJS.Platform): Promise; /** * Whether `file` should be compressed: a regular file larger than one * filesystem block, in a compressible format, with a single link, and not * already stored compressed. A single-block file cannot shrink, and replacing * a hard-linked file would split it from its other names. A compressed file * allocates fewer blocks than its logical size; session files are never * sparse, so that comparison identifies them. */ export declare function compressCandidate(file: string): Promise; /** * Count, and with `apply` remove, scratch directories under `roots` that a * killed run left behind; the caller's gc lock rules out a live one. Only a * directory holding the owner marker is removed recursively. An unmarked one * is gc's only while empty (a run killed before writing the marker). */ export declare function sweepCompressScratch(roots: string[], apply: boolean, errors: string[]): Promise; /** * Compress `candidates` in place. The caller must hold whatever lease keeps * writers off these files. * * APFS: each directory's files are copied with compression into a scratch * directory beside them, and a copy replaces its original only when its size * and SHA-256 match and the original is unchanged since it was selected. * Paths in `transcripts` (files with a session header) swap under the session * publish lock. NTFS: the filesystem compresses each file in place. */ export declare function compressFilesInPlace(candidates: CompressCandidate[], method: CompressMethod, transcripts: ReadonlySet): Promise; /** * Whether `method` actually stores a compressible file compressed under `dir`. * The volume type alone does not prove it: on macOS 27 `ditto --hfsCompression` * exits 0 but writes plain copies (#16244), and policy can disable NTFS * compression. Runs one throwaway file through {@link compressFilesInPlace} * inside a scratch directory the sweep reclaims if this process dies. Throws * when the compression tool itself fails, so a broken run is not mistaken for * a volume that stores files uncompressed. */ export declare function compressionWorks(dir: string, method: CompressMethod): Promise;