import { ErrorInterface, SuccessInterface } from "../../config/Interfaces/Helper/response.helper.interface"; import { WALEntry } from "../../config/Interfaces/Transaction/transaction.interface"; export default class WriteAheadLog { private readonly walPath; private readonly transactionDir; private readonly FileManager; private readonly FolderManager; private readonly Converter; private readonly ResponseHelper; private readonly collectionPath; private pendingEntries; private batchSize; private flushTimeout; private readonly flushDelayMs; constructor(collectionPath: string, transactionId: string); createWAL(): Promise; /** * Appends a single log entry. For better performance, use appendLogBatch. */ appendLog(entry: WALEntry): Promise; /** * Appends multiple log entries in a single disk write operation. * Much more efficient than calling appendLog multiple times. * * @param entries - Array of WAL entries to write * @returns Success/Error result */ appendLogBatch(entries: WALEntry[]): Promise; /** * Queues an entry for batched write. Flushes automatically when batch is full * or after a short delay. * * @param entry - WAL entry to queue */ queueEntry(entry: WALEntry): void; /** * Flushes all pending entries to disk immediately. */ flushPendingEntries(): Promise; getLogEntries(): Promise; deleteWAL(): Promise; redo(): Promise; undo(): Promise; private calculateChecksum; }