TransFS::Index
The SQLite index: a materialized facet view folded from the claim logs (docs/architecture.md §6). It is a rebuildable cache, never the source of truth — delete it and the next open rebuilds it from the logs.
Two deliberate deviations from the §6 DDL, both because this is a disposable cache, not the truth layer:
- ids/hashes are stored as hex TEXT, not BLOB — debuggable with the sqlite3 CLI, no hex<->bytes conversion at every boundary, and the whole codebase already speaks hex. 32 bytes/row is irrelevant for a personal archive's metadata.
- the db lives at
<root>/.transfs/index.db(the §6 DDL sketch wrote<root>/files.db).
Constructors
Instance methods
CLI find tag:<key> — docs having key as any component of a tag-path.
The documents matching a walk (S), newest first. Empty walk => all docs.
limit is optional and currently unused by the mount (no paging yet — it
lists everything); kept for when DirFiller-based paging lands (§7 scale).
The facet entries at a walk position: the distinct next path-component among
S's tag-paths with prefix partial, kept only if it would actually narrow S
(some doc lacks it, or it branches further) — the §7 appearance rule.
Materialize one document's facet rows (delete-then-insert so it's idempotent — safe to call after every mutating op to keep the index fresh).
The collision neighborhood (§7): documents sharing a name (and type) — the stable set against which a minimal distinguishing description is computed. Exposed now; the description-rendering UX is a later slice.
Does a tag-path equal path exactly (a completed tag, not just a prefix)?
Does any tag-path equal prefix or extend it (prefix/...)? Drives the
walk's boundary detection: a segment extends the current partial iff this is
true; otherwise the partial was a completed leaf and a new tag begins.
Fold path components into a Walk: greedily extend the current partial while it stays a real tag-prefix; a component that can't extend it starts a fresh tag (the old partial becomes an AND constraint). Crucially, when the partial reaches a COMPLETE tag it is committed as a constraint and reset to empty — so the next position enumerates the docs' other keys (co-facets), not just the (nonexistent) children of the completed leaf (§7: "P' is a stored tag => reset").