Expand description
Codec abstraction for tier serialization (Phase 14.6 — DS-14-storage Q4 lock, M4.B 2026-05-10).
Tiers parameterize over a Codec<T> to encode values before
backend.write and decode bytes after backend.read. JsonCodec is the
default (zero-sized, parity-encoded to match TS jsonCodec). DagCbor /
zstd codecs land in later sub-slices when content-addressing scenarios
surface.
§Parity with TS jsonCodec
TS jsonCodec.encode runs values through stableJsonString — recursive
key-sort + JSON.stringify(_, undefined, 0). JsonCodec mirrors via
serde_json::to_value (BTreeMap-backed Map, sorted iteration) →
serde_json::to_vec. Snapshot files written by the Rust impl are
byte-identical to TS for the value schemas Graph emits (ASCII keys,
integer numerics, no floats).
Structs§
- Json
Codec - Zero-sized JSON codec — UTF-8 text, canonical (sorted-key) JSON. Matches
TS
jsonCodecbyte-for-byte on the value schemas Graph emits.
Enums§
- Codec
Error - Codec encode / decode failures. Stringified internally — the underlying
serde_json::Errorcarries position info in itsDisplayimpl.
Traits§
- Codec
- Codec for tier serialization. Tiers call
encode(value)beforebackend.writeanddecode(bytes)afterbackend.read.name+versionsurface at the tier level forformat_versionmigration (Q4).