Skip to main content

Module store

Module store 

Source
Expand description

store — walk, locate, and shard a db.md store.

A db.md store is one directory marked by an uppercase DB.md at its root. Store::open is the single gate every store-walking subcommand goes through; a missing DB.md is the NotAStore error (NOT_A_STORE). The toolkit never guesses a store root.

Scale discipline lives here: Store::walk and the layer/type-folder walks are SWEEP primitives used only by validate --all, index rebuild, and stats. The interactive loop instead uses Store::find_links_to / Store::find_links_to_any (embedded ripgrep, presence-only) and the index.jsonl sidecar readers (Store::find_by_type / Store::find_by_where / Store::read_type_index) — never a whole-store parse. The batch Store::find_links_to_any is what keeps the working-set validate’s incoming-linker discovery a single store scan rather than one scan per changed object.

Structs§

NotAStore
Returned when a path is opened as a store but has no DB.md at its root. Surfaced as the structured code NOT_A_STORE with a non-zero exit.
Store
An opened db.md store: its root path plus the parsed DB.md Config.

Enums§

Layer
The three canonical layers of a db.md store.
StoreError
Errors from store-level operations (walk, locate, shard, sidecar read).

Functions§

infer_type_from_path
Infer a content file’s canonical type from its store-relative path — the inverse of [default_type_folder] and the single source of truth for path→type inference (the CLI’s fm init calls this, never re-derives it).
layer_for_type
The canonical Layer a type_ belongs to, derived from its default type-folder (emailSources, contactRecords, wiki-pageWiki, unrecognized → Records). The write path uses this to decide whether an agent-supplied folder is in the right layer for the type before honouring its sub-folder choice.