import { type UpdateFrame, UpdateLog } from "./updatelog.js"; /** * In-memory view of a table's update log: `internalId -> { cols, updatedAt }`. * * `cols` holds the *encoded* column values exactly as `joinPathesContents` * produces them (one entry per changed top-level column), so a merged read can * decode them with the same field config as the base columns. The overlay is * keyed by the internal numeric id, which is stable across line shifts caused * by `post`/`delete`, so it never has to be rebuilt when rows move. * * Freshness: `refresh()` compares the log's size and mtime with the last scan. * A change means another writer appended (or truncated) and the overlay is * rebuilt from `baseGen + 1`. `baseGen` is pinned by the caller from the * table's `.format` marker; a compaction (3.9) bumps it and the caller creates * a fresh overlay. */ export declare class TableOverlay { readonly log: UpdateLog; readonly baseGen: number; committedGen: number; readonly byId: Map; updatedAt?: number; }>; private scannedSize; private scannedMtimeMs; constructor(tablePath: string, baseGen: number); get size(): number; get(id: string | number): { cols: Record; updatedAt?: number; }; has(id: string | number): boolean; delete(id: string | number): boolean; /** Fold one committed frame onto the in-memory view (last write wins). */ applyFrame(frame: UpdateFrame): void; private currentStat; /** * Reader refresh: rebuild only when the log file changed since the last * scan. Both size *and* mtime are compared: a repaired torn tail followed by * a same-size append (truncate + regrow) changes mtime even when the length * is unchanged, which closes the stale-size window flagged in the plan. A * torn tail is ignored (only complete, checksum-valid frames are applied); * mid-log corruption is surfaced by the scanner. */ refresh(): Promise; /** * Writer refresh: hold the table lock, repair any torn tail, then rebuild * from the committed boundary. Never leaves unreadable bytes behind the * next frame. */ refreshForWrite(): Promise; /** * Apply frames that were just durably appended by this process without a * rescan, and realign the scanned stat with the file. Only valid right after * `refreshForWrite()` and while still holding the writer lock. */ applyLocal(frames: UpdateFrame[]): Promise; }