/** * On-disk format marker for a table directory. * * Format 1 is the implicit legacy format (no `.format` file): base columns plus * pagination only. Format 2 opts the table into the append-only update log * written by `put` (see `updatelog.ts`). * * The marker is the single source of truth for "does this table have a log?". * It also carries the compatibility contract read by a later 3.7.1 detector: * `minReader` is the oldest engine that may open the table, `detector` the * release that hard-fails instead of silently mis-reading. `baseGen` is the * generation the base columns were last compacted at; it is bumped by * compaction (3.9) so a stale in-memory overlay can detect that its base moved * and rebuild instead of replaying frames that are already merged. */ export declare const FORMAT_FILE = ".format"; export interface TableFormat { format: number; log: boolean; baseGen: number; /** Oldest engine that may open the table, as written into the marker. */ minReader?: string; } export declare const LEGACY_FORMAT: TableFormat; export declare const CURRENT_FORMAT_VERSION = 2; export declare const ENGINE_NAME = "inibase"; /** This build's engine version, compared against a marker's `minReader`. */ export declare const ENGINE_VERSION = "3.8.0"; /** Oldest reader that understands format 2. */ export declare const MIN_READER = "3.8.0"; /** Release expected to detect (and refuse) format 2 rather than mis-read it. */ export declare const DETECTOR = "3.7.1"; /** Compare dotted numeric versions: >0 when `a > b`, <0 when `a < b`, else 0. */ export declare const compareVersions: (a: string, b: string) => number; /** * Why this engine cannot open a marker, or null when it can. * * Refusing *before* any column is read keeps a newer-format table from being * silently mis-read as format 2 (or legacy). Two independent conditions: * a `format` above what this build writes, or a `minReader` above the running * engine version. */ export declare const unsupportedFormatReason: (format: TableFormat) => string | null; /** * Read a table's format marker. A missing or unreadable marker is legacy * (format 1), which keeps every pre-3.8 table byte-for-byte compatible. */ export declare const readFormat: (tablePath: string) => Promise; /** The exact bytes of a format marker (shared by write and compaction commit). */ export declare const serializeFormat: (format: TableFormat) => string; /** * Write (or replace) the format marker durably and atomically (§9): stage the * bytes in the table's `.tmp` dir, fsync the temp, rename it into place, then * fsync the table directory. A crash can therefore leave either the old marker * or the new one, never a partial file — a torn marker would read back as * legacy and silently drop the log. */ export declare const writeFormat: (tablePath: string, format: TableFormat) => Promise; /** Remove the marker (used when downgrading a table back to legacy). */ export declare const removeFormat: (tablePath: string) => Promise;