Module store

Source
Expand description

Catalog persistence.

The format is a JSON document whose every key is a “table”: it is the mirror image of the relational schema described in schema.sql. Costly conclusions are saved independently, so a catalog-format change does not require recomputing them. SQLite remains deferred.

Writing is atomic (temporary file then rename): an interruption during saving cannot leave a half-written catalog behind.

Enums§

StoreError
What can go wrong when saving or loading a catalog.

Constants§

ASSETS_DIR
Where a picture goes when no single folder on disk can hold it.
CATALOG_FILE
Name of the catalog file inside the data folder.
FORMAT_VERSION
On-disk format version. Every incompatible change increments it.

Functions§

analysis_to_json
An imported analysis, field for field.
assets_dir
The folder pictures without a home on disk are written into.
catalog_path
Builds the catalog path inside a data folder.
default_data_dir
Default data location: ~/.local/share/aede, or $AEDE_HOME if the variable is set.
from_json
Rebuilds a catalog from its JSON document.
load
Loads a catalog without writing anything, including during legacy migration. Returns Ok(None) if the file does not exist yet.
load_catalog_only
Reads the catalog snapshot without loading independent conclusions.
save
Saves the catalog atomically, after preserving its independent conclusions.
save_catalog_only
Writes only the rebuildable catalog, for a restore that handles each store independently.
to_json
Turns a catalog into its JSON document, one array per table.
write_new_atomic
Writes a new sidecar through a temporary file, never replacing an existing one.