Skip to main content

Module archive

Module archive 

Source
Expand description

Archive [MemBackend] — a sealed .mem zip mem, read-only.

The third sibling of folder and git-branch backends. Mem content lives compressed inside a zip; the engine reads markdown entries through this backend without unzipping to disk. Write methods return BackendError::Sealed — archive-mounted mems are distribution artifacts, not edit targets.

§Reading

list_entities and read_entity open the archive on each call. No in-memory caching for V1: the read paths exist primarily for the engine’s load-on-mount step, which calls list_entities once and read_entity once per entry. Hot-path callers (e.g. interactive memstead_entity tools against a mounted archive) re-pay the open cost per request — acceptable for V1, optimisable later behind the same trait surface.

Mirrors the read semantics of crate::entity::source::EntitySource::ZipArchive:

  • Symlinks rejected (the archive backend refuses to surface them even though it never extracts).
  • Zip-slip protected via enclosed_name.
  • Only .md files outside the .memstead/ namespace surface as entities; archive-internal config / schema files are skipped at this layer (separate read paths consume them).

§Writes and provenance

Every write method returns BackendError::Sealed. read_provenance returns an empty vector — archives carry no mutation log; the distribution artifact is by definition history-free at the engine seam. append_provenance returns Sealed rather than silently dropping; the engine’s mutation pipeline branches on capability before reaching the backend, so a Sealed here signals an upstream bug.

Structs§

ArchiveBackend
Archive-backed crate::backend::MemBackend. Holds either the on-disk path to the sealed zip or an in-memory byte buffer; opens the archive lazily on each read call.