Skip to main content

Module memory

Module memory 

Source
Expand description

Concrete tier implementations + memory factories (M4.B 2026-05-10).

Three generic structs back the three tier sub-traits:

Each holds:

  • backend: Arc<B> (shared, multi-tier-share-one-backend supported per D147)
  • codec: C (default JsonCodec per D148)
  • name: String, debounce_ms, compact_every — cadence knobs
  • filter, key_of — optional closures (boxed dyn Fn per D149)
  • Internal pending buffer (parking_lot::Mutex’d)

Convenience factories memory_snapshot() / memory_append_log() / memory_kv() wrap a fresh in-process backend.

Structs§

AppendLogStorage
Append-log tier — buffers per-key entries; flush() encodes each bucket as an array via codec and merge-writes it into the backend. Mirrors TS appendLogStorage.
AppendLogStorageOptions
KvStorage
Key-value tier — buffers per-key pending writes; flush() encodes each value via codec and writes it to the backend. Mirrors TS kvStorage.
KvStorageOptions
SnapshotStorage
Snapshot tier — buffers one pending snapshot; flush() encodes via codec and writes to the backend under key_of(snapshot). Mirrors TS snapshotStorage(backend, opts).
SnapshotStorageOptions
Options for SnapshotStorage construction.

Functions§

append_log_storage
Factory: wrap a backend as an append-log tier.
kv_storage
Factory: wrap a backend as a kv tier.
memory_append_log
memory_kv
memory_snapshot
Convenience: snapshot tier over a fresh in-memory backend.
snapshot_storage
Factory: wrap a backend as a snapshot tier.