export type OwnedFileRead = { state: "absent"; } | { state: "present"; bytes: Buffer; mode: number; } | { state: "unreadable"; detail: string; }; export type OwnedFileAction = "assert" | "write" | "remove"; export type OwnedFileExpectation = { absent: true; } | { sha256: string; mode?: number; }; export interface OwnedFileStep { action?: OwnedFileAction; path: string; mode: number; contents?: Buffer; expect: OwnedFileExpectation; prior?: Buffer; priorMode?: number; announce?: () => void; } export interface OwnedFilePolicy { label: string; maxFileBytes: number; contentDirectoryMode: number; stateDirectoryMode: number; statePaths: ReadonlySet; assertOwnedPath(path: string, ownState: boolean): void; assertResolvedSegments(segments: readonly string[], requested: string, ownState: boolean): void; assertAction?(path: string, action: OwnedFileAction, ownState: boolean): void; } export interface OwnedFileTransactionDeps { rename?: (from: string, to: string) => void; beforeEffects?: () => void; afterEffects?: () => void; } export declare function resolveOwnedFileRoot(root: string, label: string): string; export declare class OwnedFileTransaction { private readonly root; private readonly policy; private readonly rename?; private readonly beforeEffects?; private readonly afterEffects?; constructor(root: string, policy: OwnedFilePolicy, deps?: OwnedFileTransactionDeps); private ownState; private assertAction; private assertSafeParents; inspect(path: string): OwnedFileRead; read(path: string): Buffer | undefined; private prepareDirectory; writeAtomic(path: string, contents: Buffer, mode: number): void; remove(path: string): void; private assertExpected; commit(input: readonly OwnedFileStep[]): void; private rollback; }