Skip to main content

tree

Function tree 

Source
pub fn tree(
    store: &Store,
    layer: Option<Layer>,
    type_: Option<&str>,
) -> Result<Tree, StoreError>
Expand description

SWEEP. Build a Tree of the whole store (layer → type-folder → file), optionally scoped to one layer and/or one type. Off the interactive loop.

The grouping mirrors the db.md content model: a type-folder is an immediate child directory of a layer (records/contacts, sources/emails); its files are every .md content file beneath it, aggregated across date-shards (sources/emails/2026/05/*.md). Meta files never appear: the per-folder index.md, the root DB.md, and log.md / the log/ archive dir are all skipped, as are hidden dot-dirs. A loose .md file sitting directly under a layer (with no enclosing type-folder) has no slot in the layer → type-folder → file model and is therefore not listed.

Ordering is total and deterministic so two runs — and a human vs. a machine reader — never disagree: layers in canonical Layer::all order, then type-folders by store-relative path ascending, then files by store-relative path ascending. Empty layers and empty type-folders are omitted.