/** * Where the store actually lives. * * The core decides what a record is and when two are the same; this decides * where the bytes go. Split that way for the reason every module here is: * `@trazum/core` stays browser-safe, and the CLI keeps its monopoly on I/O. * * **Append-only, one buffer per write.** A pull appends a single block and * never rewrites what is already there. Two consequences worth stating: a * crash during a write loses the tail of one block rather than a year of * measurements, and two runs writing at once interleave whole blocks rather * than half-lines. Compaction is a separate, explicit errand — `store * --prune` — because collapsing a log is the one operation that destroys * something, and it should never happen as a side effect of a pull. * * **A line that will not parse is kept, counted and skipped.** The store is a * file a human may open, a backup may truncate and a merge may mangle. Losing * the whole month because one line is broken would be the worst possible * response; so would silently pretending the month is complete. */ import type { ResolvedStore, StoreRecord } from '@trazum/core'; /** The directory name, relative to wherever the caller roots the store. */ export declare const STORE_DIR = ".trazum/store"; export interface StoreReadResult { resolved: ResolvedStore; /** Lines that would not parse: counted and named by file, never dropped quietly. */ unreadable: { file: string; line: number; }[]; /** Files read, so an empty store can be told from an unread one. */ files: string[]; } /** * Reads every record in the store. * * Returns an empty result rather than throwing when the store does not exist: * "you have not stored anything yet" is a state, not an error, and the caller * says so in a sentence that names `trazum connect`. */ export declare function readStore(root: string): Promise; /** * Appends records, grouped into one write per month file. * * Nothing already on disk is read, rewritten or resolved here: convergence * happens when the store is *read*, which is what keeps a write cheap enough * to run on a schedule and impossible to corrupt by racing. */ export declare function appendRecords(root: string, records: readonly StoreRecord[]): Promise; /** * Rewrites the store with exactly the records given. * * The one operation that destroys something, so it is only ever reached from * an explicit `--prune`. Each month file is written whole, and a month left * with nothing is written empty rather than removed — a missing file and an * empty one say different things to whoever looks next. */ export declare function rewriteStore(root: string, records: readonly StoreRecord[]): Promise; //# sourceMappingURL=store-fs.d.ts.map