export interface BackupOptions { /** Source DB (default: /.swarm/memory.db). */ dbPath?: string; /** Destination dir (default: /backups). */ destDir?: string; /** Rotation: keep the newest N snapshots (default 7 = a week of nightlies). */ keep?: number; /** Optional offsite: a gs://bucket/prefix to also upload the snapshot to. */ gcs?: string; /** Injected epoch millis (tests pass a fixed value; avoids Date.now in logic). */ timestamp?: number; verbose?: boolean; } export interface BackupResult { backedUp: boolean; path?: string; sizeBytes?: number; rotatedAway?: string[]; gcsUri?: string; skipped?: string; } export declare function defaultMemoryDbPath(cwd?: string): string; export declare function backupMemoryDb(opts?: BackupOptions): Promise; export interface RestoreResult { restored: boolean; /** The backup file that was restored. */ from?: string; /** memory_entries count in the restored DB (-1 if it couldn't be verified). */ rows?: number; /** Where the corrupt live DB was parked before the swap. */ corruptBackupPath?: string; skipped?: string; } /** * Restore the newest integrity-ok backup over a corrupt/malformed memory DB * (issue #2584). * * The in-place rebuild path (`recoverMemoryDatabase`) rebuilds FROM the corrupt * image, so when the damage is bad enough that `sqlite3 .recover` salvages * nothing, that rebuild also salvages nothing and every `memory_store` keeps * erroring. This is the missing fallback: scan `/backups/` newest-first, * pick the newest snapshot that passes `PRAGMA integrity_check` (and has rows), * park the corrupt live DB at `.corrupt-.bak`, then ATOMICALLY install * the good backup (copy → fsync → rename, no full-image buffer in memory). Drops * stale -wal/-shm. Non-destructive on failure: the live DB is only replaced once * a verified backup is in hand. */ export declare function restoreMemoryDbFromBackup(dbPath: string, opts?: { destDir?: string; timestamp?: number; verbose?: boolean; }): Promise; //# sourceMappingURL=memory-backup.d.ts.map