---
title: "treestore-store — Mova code model"
description: "Mova code model of tools/treestore/src/store.rs: components with their labels, obernants and the model text."
url: "https://groupants.elamur.ai/free/en/mova/tools/treestore/src/store.rs.groupant/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Research](https://md.research.elamur.ai/free/en/) · **Groupants**

This page as HTML: <https://groupants.elamur.ai/free/en/mova/tools/treestore/src/store.rs.groupant/>

# 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

- **kind:** groupant
- **status:** partial source bound model
- **source:** [`tools/treestore/src/store.rs`](https://github.com/ElamurAI/mova-free/blob/main/tools/treestore/src/store.rs)
- **repository folder:** [`tools/treestore/src/store.rs.groupant`](https://github.com/ElamurAI/mova-free/tree/main/tools/treestore/src/store.rs.groupant)

> **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 | [Approximant](#approximant) |
| **Ast** | partial | `syntax.json` |
| **Composition** | partial | [Composition](#composition) |
| **Cost** | symbolic source derived | [Invariant](#invariant) |
| **Descriptant** | present | [Descriptant](#descriptant) |
| **Invariant** | partial | [Invariant](#invariant) |
| **Tests** | executed bounded checks | [Tests](#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](#behavior-complement) |
| Reverse reconstruction | reverse reconstruction | partial source derived model | [Reverse reconstruction](#reverse-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

- **source SHA-256:** `2e4df757d11dab5b…`
- **repository commit:** `f55191f0d47f`
