/** * @fileoverview Lock-serialized checkpoint and native-close proof for an * existing SQLite file. */ import { type SqliteLifecycleConnection } from './backends/shared.js'; import type { DataStoreLockContext, DatastoreCloseResult } from './data-store.js'; /** @internal * Optional maintenance authority for callers that already hold a stronger * lifecycle lease. Ordinary datastore callers retain the adjacent lock path. */ export interface SqliteCheckpointOptions { /** Stable, caller-owned lock location outside a runtime tree being moved. */ readonly lockPath?: string; /** Runs inside the acquired lock immediately before the native open. */ readonly beforeOpen?: () => void; /** Runs after native open and before checkpointing; deterministic fault seam. */ readonly afterOpen?: () => void; /** Reasserts authority after the fault seam and immediately before checkpoint. */ readonly beforeCheckpoint?: () => void; /** Runs inside the acquired lock after checkpoint and native close. */ readonly afterClose?: () => void; } /** @internal Native-open seam used only by datastore-owned lifecycle tests. */ export interface SqliteCheckpointDependencies { readonly openDatabase: (path: string) => SqliteLifecycleConnection; } /** * Recover the bounded native-close proof from a checkpoint failure. * * Callers must treat `undefined` conservatively: only this datastore-owned * error proves whether a native handle was closed. */ export declare function sqliteCheckpointFailureResult(error: unknown): DatastoreCloseResult | undefined; /** * Checkpoint and close an existing SQLite file while serialized by its normal * datastore write lock. * * The caller must already hold the runtime's exclusive maintenance lease. This * function uses `fileMustExist`, does not migrate or vacuum, and reports whether * the native connection is proven closed. */ export declare function checkpointSqliteFile(path: string, lockContext: DataStoreLockContext, options?: SqliteCheckpointOptions): DatastoreCloseResult; /** * @internal Use {@link checkpointSqliteFile} outside datastore tests. * @throws {SqliteCheckpointLifecycleError} When lock, open, checkpoint, hook, or close fails. */ export declare function checkpointSqliteFileWithDependencies(path: string, lockContext: DataStoreLockContext, options: SqliteCheckpointOptions, dependencies: SqliteCheckpointDependencies): DatastoreCloseResult; //# sourceMappingURL=sqlite-checkpoint.d.ts.map