Skip to main content

Module index

Module index 

Source
Expand description

Fast unit index cache.

The index (index.yaml) is a compact summary of all active units, built by scanning every unit file in the .mana/ directory. It lets the CLI answer list/filter/graph queries without parsing every individual unit file.

The index is rebuilt automatically whenever unit files are newer than the cached index.yaml. It is saved atomically to prevent corruption.

§Usage

use mana_core::index::Index;
use std::path::Path;

let mana_dir = Path::new("/project/.mana");

// Load from disk, rebuilding if stale
let index = Index::load_or_rebuild(mana_dir).unwrap();
println!("{} units", index.units.len());

// Force a full rebuild from unit files
let index = Index::build(mana_dir).unwrap();
index.save(mana_dir).unwrap();

Structs§

ArchiveIndex
Index
The in-memory and on-disk unit index.
IndexEntry
A lightweight summary of a single unit, stored in the index cache.
LockedIndex
Exclusive handle to the index, backed by an advisory flock on .mana/index.lock.

Functions§

count_unit_formats
Count unit files by format in the units directory. Returns (md_count, yaml_count) tuple.