Expand description
SOMA1 framed binary codec for Value.
The persistent cache stored values as JSON in Phase 1 — an f64 tensor round-tripped through decimal text at ~3× the size. This codec writes tensors as raw little-endian f64, keeping payloads at ~1× raw size, and hashes the encoded bytes with BLAKE3 in the same pass.
Frame layout:
[0..6) magic b"SOMA1\0"
[6] variant tag: 0=Empty 1=Tensor 2=Json 3=Bytes 4=Object
[7] compression: 0=raw (other values reserved)
[8..] payloadTensor payload: u32 ndim + ndim × u64 dims + u64 count +
count × f64 little-endian values. Json payload: serde_json
bytes (deterministic — the default map is sorted). Bytes/Object:
raw bytes.
Constants§
- MAGIC
- Frame magic: the first six bytes of every
SOMA1-encoded value. Public so stores can sniff a blob’s format without decoding it.
Functions§
- decode_
value - Decode a
SOMA1frame back into a value. - encode_
and_ hash - Encode and content-hash in one step.
- encode_
value - Encode a value into a
SOMA1frame.