Skip to main content

is_content_path

Function is_content_path 

Source
pub fn is_content_path(rel: &Path) -> bool
Expand description

True if a store-relative path is a db.md content file: rooted in a real layer (sources/ or records/ as its FIRST component), with a .md extension, and not an index.md sidecar. This is the SPEC’s “content files = everything under sources/ and records/ only” predicate (SPEC § content files), keyed on the first component so a non-layer top-level dir is never content even if a deeper component happens to be named records/sources (e.g. EXPECTED/records/x.md, archive/sources/y.md).

It mirrors the graph engine’s content filter so the surfaces that READ the store (graph backlinks) and the surface that MUTATES it (rename) agree on exactly which files are content. rename uses it to restrict its link-rewrite set: a store-root file, a non-layer dir (scratch/, EXPECTED/, archive/), or an index.md is NEVER rewritten — rename does not own those bytes. The broad store scan (Store::find_links_to_any, shared with the read-only working-set validate) is left untouched; the filter is applied at the point of mutation.