Mova0.6 pre-release

mova-pack

Prepare-then-zstd storage for Mova's big stores. Level 1 prepares the data: JSON lines become template lines against a template dictionary; CoNLL-like token files (.tok, .conllu) become typed streams (comment values per key, token columns apart, typical-value tables, predictions). Level 2 compresses each block with zstd-9 and a zstd dictionary trained on the prepared sample. Every container is cut into blocks of whole records that decode alone, and a separate offset index (<name>.idx.zst) maps record keys to (block, offset), so one document is read by decoding one block. Store files are replaced only after a verified round trip. How it works and what it measured: Compression: prepare, then a fast zstd.

Commands

mova-pack pack   IN OUT.mpk [--kind auto|tok|json|lines|bytes] [--id [NAME=]SPEC]... [--prep auto|on|off]
                 [--level 9] [--block 1048576] [--threads 4] [--sample BYTES] [--split doc|sent]
                 [--zdict FILE] [--no-zdict] [--dicts DIR] [--min-free GB] [--format 1]
mova-pack cat    IN.mpk [--threads 4]                 the original, byte for byte, to stdout
mova-pack get    IN.mpk RECORD                        one record by its number
mova-pack get    IN.mpk --id KEY | --key NAME=KEY     the records of a key, through IN.idx.zst
mova-pack unpack IN.mpk OUT
mova-pack verify IN.mpk...                            full read against the stored sha256, index opened
mova-pack info   IN.mpk                               the header
mova-pack repack FILE... [pack options] [--source PATH]
mova-pack gc     ROOT... [--dicts DIR]... [--grace-days 7] [--apply]
mova-pack dict   --kind json|lines --out DIR [--sample BYTES] [--zdict-size BYTES] INPUT...
mova-pack timeget IN.mpk N                            diagnostic: N reads by key, p50/p95
mova-pack bench  pmc|json|openalex|textparquet SAMPLE OUTDIR [--quick] [--current-bytes N] [--domain KEY|p31]
mova-pack templates IN [N]                            diagnostic: the template dictionary of a JSON input

Inputs that are gzip, zstd or .mpk (recognized by their magic bytes) are decoded first, as a stream; the original is their content.

Build and test

cargo build --release -p mova-pack                      # mova-pack in target/release/
cargo build --release -p mova-pack --features parquet   # with the parquet readers for bench
cargo test --release -p mova-pack

Format

Format 2 (.mpk, written by pack and repack): magic MOVAPACK\x02\n, an embedded zstd dictionary (unless it is referenced in a dictionary directory), the blocks (independent zstd frames), then a footer: a zstd frame of the header JSON (kind, preparation, keys, level, block size, the original's size and sha256, record and block counts, dictionaries), a zstd frame of the block table (varints per block: records, raw bytes, compressed bytes) and a 32-byte tail (footer offset, header and table frame lengths, MPK2END\n). Each block decodes alone to its exact original bytes; the original is the concatenation of the blocks.

Format 1 (still read): magic MOVAPACK\x01\n, header length (u32 LE), header JSON with the block list, data area.

The index <name>.idx.zst is a plain zstd stream: zstd -dc prints TSV lines name \t key \t block \t offset \t count, sorted by name and key, in zstd-9 frames of 8192 lines with content checksums; two skippable frames after them hold the chunk table (bound to the container's content sha256, record and block counts) and its sha256. A lookup decodes one frame. The formats are not frozen yet.

Rust callers can use pack::open_text(path) as a streaming reader. It tries the requested path, then appends .mpk and .zst in order if the path is missing. MPK integrity is checked on a complete read to EOF. A malformed preferred archive returns an error. For MPK containers with externally stored dictionaries, use pack::stream::content_reader with the explicit path and dictionary directories.

Limits

Format 1 holds the whole input in memory; format 2 holds the index entries (keys of all records) in memory until the end. One writer per directory; no locking. JSON is kept exactly as written, never normalized. gzip and parquet encodings are not reproduced: a repacked .gz or .zst becomes an .mpk of its content, and readers must change with it. A prefix key's continuation records are checked only through their run, not by their own text.

This page in Markdown https://md.mova.elamur.ai/free/en/docs/pack/