mova-elephant-store
The groupant beside tools/elephant/src/store.rs in the Mova repository: what the code computes, what it never does, how to go back from its outputs, its invariants, cost and checks.
Facts
Implementation material. A Mova code model describes this code at one source revision: partial models, finite checks and their stated scope. It is not a reviewed general exposition, and its labels are shown as written, never raised.
Components
| component | label | where |
|---|---|---|
| Approximant | partial | Forward approximant |
| Ast | partial | syntax.json |
| Composition | partial | Composition |
| Cost | partial | Cost |
| Descriptant | present | Descriptant |
| Invariant | partial | Invariant |
| Tests | finite evidence | Tests |
Obernants
The typed relations around the forward model: the behaviour complement (what the code never does), the reverse reconstruction (every input compatible with an output) and specialised views.
| relation | type | label | where |
|---|---|---|---|
| Behavior complement | behavior complement | partial source derived model | Behavior complement |
| Reverse reconstruction | reverse reconstruction | partial source derived model | Reverse reconstruction |
Model text
Descriptant
The Elephant's incremental word graph: an LSM store of counts (immutable runs, delta parts read in place, retractions) with the word graph as its view, versioned by generations. Source: tools/elephant/src/store.rs.
Forward approximant
add: scan the pass's finished parts, hash, skip counted hashes, refuse a counted name with other contents, a key the store does not admit or a file that does not hash to its sidecar -> deltas; tamp: the fan_in smallest units (all with major) plus runs holding a retraction -> merge::compact -> one run; view: stage runs and deltas as one pass of symbolic links -> wordgraph::compile::build, named by lineage and reused; rekey: attestations, retractions, new key; every change -> history/<generation>.json, manifest.json, journal.jsonl.
Invariant
I1 a part hash is counted at most once; I2 every counted part has the store's key or an attestation; I3 the view over runs and deltas equals the wordgraph build over the original parts in every section but provenance, given the same OOV registry state; I4 one graph per lineage. Nothing is deleted.
Cost
add: one hash per part (95 parts in 1.0 s); tamp: as merge (13 tamps with fan-in 8 over 95 parts: 77 s); view: one wordgraph build over the staged inputs (4 runs + 5 deltas: 39 s, 0.73 GB, against 54 s, 1.25 GB for the full build of 100 parts; 2026-11-06).
Composition
Parent: elephant. Uses part, merge, key and wordgraph::compile; used by reprogram, animal, work and main.
Behavior complement
Never copies or deletes a part; never subtracts in a view; never admits another key without an attestation; never writes the hand lists. Evidence status: source-derived model with finite checks, not a proof.
Reverse reconstruction
history/<generation>.json reconstructs every state; a run's part list recovers its inputs; the lineage names the counted part set.
Tests
Checks
lsm: runs + deltas = full build, major tamp reuses the view and its rebuild is equal, another order and fan-in give the same run bytes, retraction = full build without the part, refusals of another key, a bad hash, an uncounted retraction and a changed part. These are finite fixtures and measurements; not a proof.
History
2026-11-06 · document
Epoch 2026-11-06
First model, written with the source (the Elephant made incremental and an animal on Mova).
Provenance
This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/tools/elephant/src/store.rs.groupant/