/** * Recovery module for FeltDB * * Implements recovery of database state from operation logs and checkpoints. * Ensures that: * - Records are reconstructed correctly * - Indexes are restored * - Derived collections rebuild correctly * - Subscriptions continue to work * - All counts and queries produce correct results */ import type { Operation } from './operation.js'; import type { JsDb } from './feltdb.js'; /** * Recovery information for diagnostics */ export interface RecoveryInfo { /** Total operations recovered */ operationsRecovered: number; /** Checkpoint data recovered */ checkpointRecovered: boolean; /** Total records reconstructed */ recordsReconstructed: number; /** Recovery duration in milliseconds */ durationMs: number; /** Whether recovery completed successfully */ successful: boolean; /** Error message if recovery failed */ error?: string; } /** * Recover database state from operation log and checkpoints * * This function: * 1. Loads checkpoint if available (base state) * 2. Replays delta operations on top of checkpoint * 3. Reconstructs all in-memory state * 4. Re-establishes indexes * 5. Rebuilds derived collections * * The process is transparent to the application - it sees the same * state as if the database had never stopped. */ export declare function recoverFromLog(jsDb: JsDb, operationLog: Operation[]): Promise; /** * Verify that recovered state is correct * * This is primarily for testing to ensure recovery worked properly. * Verifies: * - Records are present * - Indexes work * - Derived collections can be queried * - Subscriptions can be created * - Counts are accurate */ export interface RecoveryVerification { recordsPresent: number; queriesWorking: boolean; derivedCollectionsRebuild: boolean; subscriptionsWork: boolean; countsAccurate: boolean; allVerificationsPass: boolean; } /** * Run verification tests on recovered state */ export declare function verifyRecovery(jsDb: JsDb, capability: string, expectedRecordCount: number): Promise; //# sourceMappingURL=recovery.d.ts.map