/** * Write Batcher - Batches multiple writes and flushes them together. * * This reduces fsync overhead by batching writes and doing a single * fsync for the entire batch instead of one per write. */ import type { Wal } from './wal'; import type { KeyIndex } from './key-index'; import type { PendingWrite, WriteBatcherOptions, FlushResult } from './write-batch'; export declare class WriteBatcher { private readonly dataPath; private readonly wal; private readonly index; private readonly dimension; private readonly maxBatchSize; private readonly maxBatchDelayMs; private readonly maxBatchBytes; private dataHandle; private dataHandlePromise; private pendingWrites; private flushScheduled; private currentBatchBytes; private flushMutex; private closed; private currentDataFileSize; constructor(dataPath: string, wal: Wal, index: KeyIndex, dimension: number, options?: WriteBatcherOptions); /** * Initialize the batcher by getting current data file size. */ initialize(): Promise; /** * Calculate the offset for a new write. * Must be called under external synchronization (the storage engine's writeMutex). */ calculateNextOffset(dataLength: number): number; /** * Queue a write operation for batching. */ queueWrite(write: PendingWrite): void; private shouldFlushNow; private scheduleFlush; private triggerFlush; /** * Flush all pending writes to disk. */ private flush; private writeDataBatch; private getDataHandle; /** * Force flush all pending writes immediately. */ forceFlush(): Promise; /** * Close the batcher, flushing any pending writes. */ close(): Promise; } //# sourceMappingURL=write-batcher.d.ts.map