Expand description
Read-mem cache resolution, published-config reads, and the install-to-cache side effect.
Every sealed-archive byte entering the cache goes through
validate_and_normalize_archive — the install path reads the
submitted archive, hands the bytes to the validator, and writes the
validator’s canonical_bytes via a temp-plus-atomic-rename so no
partial archive ever lands on disk. Steady-state loads (through
read_published_config or the entity loader) trust the cached
bytes: they were canonical at write time and re-validation on every
load would just pay for the same work twice.
The cache base path resolves via dirs::data_dir() so the same path
works on macOS (~/Library/Application Support/memstead/mems), Linux
($XDG_DATA_HOME/memstead/mems or ~/.local/share/memstead/mems), and
Windows (%APPDATA%\memstead\mems). For tests, MEMSTEAD_MEM_CACHE
overrides the base so temp dirs can stand in without touching the
user’s real data directory.
Structs§
- Install
Outcome - Outcome of an
install_read_memcall — captured so callers can log what actually happened without re-deriving it from side effects.
Enums§
- Install
Error - Schema
Extraction Error - Schema
Extraction Outcome - Outcome of
extract_archive_schema_if_needed— so callers can log the specific reason a no-op happened, or know whether the mem’s schema registry needs to be rebuilt. - Target
Mem - Where the per-mem
readMemsregistration should land.
Constants§
- CACHE_
OVERRIDE_ ENV - Env var that overrides
<data_dir>/memstead/memsfor tests.
Functions§
- extract_
archive_ schema_ if_ needed - Extract the schema embedded in
archive_pathinto the writable mem’s cache, but only when the pinned(name, version)is not already registered. - install_
read_ mem - Install a sealed mem archive into the global cache and register
it in a writable mem’s config. Accepts the
.memarchive format. - mem_
cache_ dir - Resolve the global mem-cache directory.
- read_
published_ config - Read the whitelisted
.memstead/config.jsonfrom a cached archive.