import type { EventEmitter } from 'events'; import type { BreezeDBOptions, TTLData, LoadResult } from './types.js'; /** * Persistence Manager * Handles all file I/O operations with compression and encryption support */ export declare class PersistenceManager { /** Resolved path to the main database file */ readonly filePath: string; /** Path to the backup file */ readonly backupPath: string; /** Path to the temporary file used during writes */ private readonly tempPath; /** Database configuration options */ private readonly options; /** Event emitter for persistence events */ private readonly eventEmitter; /** Flag indicating if a write operation is in progress */ isWriting: boolean; /** Queue of pending write callbacks */ private writeQueue; /** * Creates a new persistence manager instance * @param filePath - Path to the database file * @param options - Database configuration options * @param eventEmitter - Optional event emitter for persistence events */ constructor(filePath: string, options?: BreezeDBOptions, eventEmitter?: EventEmitter); /** * Serialize data to JSON string * @param data - Map of key-value data to serialize * @param ttlData - TTL data to include in serialization * @returns Serialized JSON string */ private serialize; /** * Deserialize JSON string to data * @param serializedData - JSON string to deserialize * @returns Object containing loaded data and TTL information */ private deserialize; /** * Process data through compression and encryption pipeline * @param data - Raw data string to process * @returns Promise resolving to processed data (Buffer or string) */ private processForStorage; /** * Process data through decryption and decompression pipeline * @param data - Processed data from storage * @returns Promise resolving to original data string */ private processFromStorage; /** * Synchronous version of processForStorage * @param data - Raw data string to process * @returns Processed data (Buffer or string) */ private processForStorageSync; /** * Synchronous version of processFromStorage * @param data - Processed data from storage * @returns Original data string */ private processFromStorageSync; /** * Save data to disk asynchronously * @param data - Map of key-value data to save * @param ttlData - TTL data to save * @returns Promise that resolves when save is complete */ save(data: Map, ttlData: TTLData): Promise; /** * Save data to disk synchronously * @param data - Map of key-value data to save * @param ttlData - TTL data to save * @throws Error if async save is in progress or save fails */ saveSync(data: Map, ttlData: TTLData): void; /** * Load data from disk asynchronously * @returns Promise resolving to loaded data and TTL information */ load(): Promise; /** * Load data from disk synchronously * @returns Loaded data and TTL information */ loadSync(): LoadResult; } //# sourceMappingURL=persistence.d.ts.map