Skip to main content

Module container

Module container 

Source
Expand description

container — a domain-agnostic single-file section container.

One file = magic(4) + data_version(u32 LE) + header_len(u32 LE) + header (JSON) + section blobs. Each section is a kind + name + tags + version + an opaque payload, stored zstd-compressed. The container knows nothing about the caller’s domain (surfaces / wells / models) — it round-trips tagged, versioned, kinded byte blobs and supports partial reads + filter_to / merge_to that copy compressed blobs byte-for-byte (never re-encoding a payload).

Lifted verbatim from petekio’s .pproj framing (the on-disk format is unchanged): only the error type was swapped to this crate’s [AlgoError]. petekio layers its GeoData element DTOs on top; petekSim stores an opaque model/* sidecar the container never parses.

Two-tier versioning: the 4th magic byte is the hard format version (a mismatch is refused); data_version tracks the caller’s DTO schema; the JSON header evolves via serde defaults (soft). Per-section version lets an opaque sidecar evolve independently.

Structs§

Entry
One entry in the JSON header index (metadata only — no payload).
Reader
An opened container: header parsed, blobs read lazily by offset.
Section
A section as the caller sees it: metadata + an uncompressed payload.

Functions§

filter_to
Write a new container holding only the sections whose entry passes keep, copying their compressed blobs byte-for-byte (no re-encode). Keeps the source header app. This is the engine behind split / export-by-tag.
merge_to
Merge b’s sections into adst, copying blobs verbatim. On a kind+name clash, b wins (last-writer). a’s header app is kept.
open
Open a container, reading only the header (blobs are pulled on demand).
write
Write a container from uncompressed sections (compresses each payload).