import { RetentionPolicy } from '../runtime/retention/policy.js'; export { RetentionPolicy } from '../runtime/retention/policy.js'; export { SnapshotPruner } from '../runtime/retention/pruner.js'; export type { RetentionClass } from '../runtime/retention/types.js'; export declare const STORE_SNAPSHOT_DIR = "snapshots"; /** Directory a store's snapshots live in: `/snapshots//`. */ export declare function storeSnapshotDir(dbPath: string): string; /** * Copy the store file (and any -wal/-shm sidecars) into the snapshot dir. * Returns the snapshot path, or null when there is nothing to snapshot * (in-memory store, missing file, or empty file). */ export declare function snapshotStoreFile(dbPath: string, reason: string, options?: { now?: () => number; }): string | null; export interface StoreSnapshotInfo { readonly path: string; readonly createdAt: number; readonly sizeBytes: number; readonly reason: string; } /** All snapshots for a store, newest first. */ export declare function listStoreSnapshots(dbPath: string): StoreSnapshotInfo[]; export interface RestoreStoreSnapshotResult { readonly restoredFrom: string; /** Where the replaced live file was parked (null when none existed). */ readonly keptCurrentAt: string | null; } /** * ONE command back to a snapshot. The store must be closed by the caller. * With no snapshot named, the latest one is used; the replaced live file is * parked at `.pre-restore` so even a wrong restore loses nothing. */ export declare function restoreStoreSnapshot(dbPath: string, snapshotPath?: string): RestoreStoreSnapshotResult; export interface SnapshotStoreTarget { readonly name: string; readonly dbPath: string; } export interface StoreSnapshotSchedulerOptions { readonly stores: readonly SnapshotStoreTarget[]; /** Daily-snapshot retention class limits; bounded by default. */ readonly retention?: RetentionPolicy | undefined; readonly now?: (() => number) | undefined; readonly setTimer?: ((fn: () => void, ms: number) => ReturnType) | undefined; readonly clearTimer?: ((timer: ReturnType) => void) | undefined; /** How often the scheduler wakes to check due-ness (hourly by default). */ readonly checkIntervalMs?: number | undefined; } /** Bounded defaults for store snapshots: 14 daily copies / 30 forensic days. */ export declare function defaultStoreSnapshotRetention(): RetentionPolicy; /** * Daily snapshots of every registered store, with bounded retention driven * through the retention engine after every sweep. Time and timers are * injectable; the loop never keeps the process alive. */ /** * Async twin of {@link snapshotStoreFile}: identical path/uniquify/mtime logic * with threadpool copies (fs/promises), for callers whose deadline must remain * enforceable while the disk stalls (the memory-governor tripwire exit). */ export declare function snapshotStoreFileAsync(dbPath: string, reason: string, options?: { now?: () => number; }): Promise; export declare class StoreSnapshotScheduler { private readonly options; private timer; private stopped; private readonly retention; constructor(options: StoreSnapshotSchedulerOptions); private get checkIntervalMs(); start(): void; stop(): void; private scheduleNext; /** One sweep: snapshot stores whose newest daily copy is a day old, then prune. */ tick(): Promise; /** * Snapshot every registered store NOW using ASYNC (threadpool) file copies. * This is the tripwire-exit path: synchronous copyFileSync on a stalled disk * blocks the event loop itself, so no outer timeout could ever fire, async * copyFile keeps the loop free and lets the governor's shutdown ceiling * genuinely bound the work. Best-effort per store; no pruning. */ snapshotAllAsync(reason: string): Promise; /** Register every snapshot on disk with the retention engine, then prune. */ pruneRegisteredSnapshots(): Promise; } //# sourceMappingURL=store-snapshots.d.ts.map