import type { DeltaPage, DeltaRecord } from "./delta-client.js"; type ApplyKind = "regular" | "symlink" | "delete"; export interface DurableApplyContent { kind: "regular" | "symlink"; /** Exact bytes returned by the authorized delta content descriptor. */ bytes: Buffer; /** SHA-256 hexadecimal digest authenticated by that descriptor. */ sha256: string; } export interface DurableApplyIntent { deltaId: string; canonicalPath: string; operation: ApplyKind; versionId: string | null; sha256: string | null; mode: number | null; symlinkTarget: string | null; stageName: string | null; } export interface DurableAppliedPath { deltaId: string; operation: ApplyKind; versionId: string | null; sha256: string | null; } export interface DurableApplyState { intents: Record; paths: Record; cursor: string | null; } export interface DurableApplyOptions { /** Filesystem root for one authorized scope projection. */ rootDir: string; /** Root used by the WAL v3 state store. */ stateRootDir: string; scopeId: string; initialCursor?: string | null; /** Test-only crash seam, called after each durable boundary. */ afterStep?: (step: DurableApplyStep) => void; } export type DurableApplyStep = "stage-hashed" | "stage-fdatasynced" | "stage-parent-fsynced" | "intent-durable" | "filesystem-applied" | "parent-fsynced" | "path-durable" | "cursor-durable"; export declare class DurableApplyError extends Error { constructor(message: string, options?: ErrorOptions); } export declare class DurableApplyRecoveryError extends DurableApplyError { constructor(message: string, options?: ErrorOptions); } /** * A page is the cursor unit. All path records are durable before its opaque * fixed-H cursor is appended. The caller must serialize calls per scope. */ export declare class DurableApplyEngine { private readonly rootDir; private readonly afterStep; private readonly store; constructor(options: DurableApplyOptions); getState(): DurableApplyState; /** Finish every prior filesystem intent, but never invent a page cursor. */ recover(): void; /** * Fetching is deliberately outside this module: only the authorized * deltaId-to-exact-version transport can provide bytes. Deletes never ask * for content. */ applyPage(page: Pick, fetchContent: (delta: DeltaRecord) => Promise): Promise; private beginUpsert; private beginDelete; private recoverIntent; private applyIntentFilesystem; private finishIntent; private targetPath; private step; private sweepUnreferencedStages; } export {}; //# sourceMappingURL=durable-apply.d.ts.map