Skip to main content

Module database

Module database 

Source

Structs§

Database
A directory of tables: the JSONL logs, their index snapshots, the metadata catalog (hayson.json) describing them, and one writer lock (lock::DirLock, ADR-hjxp/0006 — one writer per database directory).
Layout
Absolute paths of everything a database keeps on disk, by role — the port of the TS Layout, narrowed to the roles this engine actually writes (format 2 keeps no per-table schema files, and its write queue stages in memory rather than in a pending/ directory).
LayoutMigrationOptions
Which arrangement to move a database into, and under what name to leave its metadata document.
LayoutMigrationResult
What migrate_layout moved, or would move under dry_run.
LayoutMove
One rename the move makes, as it will be applied.
LayoutOptions
The layout/metadataFile/manifest triple of OpenOptions, exactly as a caller passed it — unresolved, because which of the two file names wins (and whether they even agree) is decided by LayoutOptions::metadata_file, and the kind by [resolve_kind].
OpenOptions
How Database::open acquires the writer lock and whether it opens for writing at all.
Problem
One finding of verify. code is a stable kebab-case identifier callers can match on; message is for people.
VerifyOptions
VerifyReport

Enums§

DatabaseError
FollowOption
Whether the tables of this database catch up with foreign writes on their own — the port of the TS OpenOptions.follow, which takes false, true or { intervalMs }.
LayoutKind
How a database directory is arranged on disk — the port of the TS LayoutKind.
LockMode
Whether Database::open takes the writer lock at all, and on what terms when it does.
RestoreOutcome
Severity
How much a finding matters to someone about to open the directory.

Constants§

DEFAULT_METADATA_FILE
Name of the metadata document a database keeps in its root when open() names none — the port of the TS DEFAULT_MANIFEST_FILE (packages/hayson/src/database/layout.ts).

Functions§

migrate_layout
Moves a database between the flat and nested on-disk arrangements.
verify
Checks a database directory without taking its lock or changing a byte, and reports what is wrong with it instead of failing on it: every damaged, missing or unreadable file becomes a Problem, never an Err and never a panic.