Elamur GroupantsβŒ•
☰

treestore-store

The groupant beside tools/treestore/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

componentlabelwhere
ApproximantpartialApproximant
Astpartialsyntax.json
CompositionpartialComposition
Costsymbolic source derivedInvariant
DescriptantpresentDescriptant
InvariantpartialInvariant
Testsexecuted bounded checksTests

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.

relationtypelabelwhere
Behavior complementbehavior complementpartial source derived modelBehavior complement
Reverse reconstructionreverse reconstructionpartial source derived modelReverse reconstruction

Model text

Descriptant

The .mts file: magic and model id, groups of consecutive articles up to a raw-size target, each stream of a group one frame (stored, zstd, zstd with the stream's dictionary, or the context coder β€” whichever is smallest: the Grand Spider's dictionary levels at stream granularity), and a zstd footer with the groups and per article its info line, JSON length and SHA-256 prefix. A streaming Writer (add/finish) and the batch writer give identical bytes. Epoch 2026-11-06: on tier 1 about 2.9Γ— smaller than the current per-article zstd 9 records and 2.1Γ— smaller than one zstd 19 --long=27 frame per shard (which has no random access).

Approximant

size(file) β‰ˆ Ξ£_groups Ξ£_streams min(zstd_dict, zstd, cm, raw) + 16Β·articles + footer. Read of one article = one seek, decompress its group's 16 frames, slice, decode, hash. Measured 2026-11-06 (shard 00050, 2 MB groups): 11.85 MB; random article (avg 530 KB of JSON) 25–60 ms; full decode 26–32 MB/s of JSON; packing β‰ˆ 4 s per 500-article shard on 6 threads, peak β‰ˆ 0.7 GB.

Invariant

For every written article: decode gives exactly the record (length and SHA-256 prefix checked on every read); every frame is decompressed and compared at write time; same records, model and settings give the same file (groups are coded in parallel but appended in order). The file appears only complete (written as .part, synced, renamed).

Composition

encode_group β†’ codec::encode per record, then compress per stream; Shard::group β†’ decompress; Shard::decode β†’ codec::decode + checks. dir.rs indexes files by title.

Behavior complement

No in-place update or deletion of articles (a changed article means rewriting its file or appending a new file), no sentence-level index inside a group, no encryption, no cross-file deduplication.

Reverse reconstruction

From a file and its model every record is recovered exactly; the footer alone recovers titles, lengths and hashes but not content.

Tests

tests/roundtrip.rs: batch vs streaming writer identical, round trip of all records, negative controls (damaged bytes in a group never return wrong bytes and are caught; a wrong model id is refused). Real-data gate: treestore verify.

Provenance

This page in Markdown β†’ https://md.groupants.elamur.ai/free/en/mova/tools/treestore/src/store.rs.groupant/