Expand description
The portable wire protocol: frames, envelopes, text conversion and
duration/timestamp domains (W04–W08 in formal/guides/CONTRACTS.md),
and the built-in confirmed-mismatch difference over JSON values.
Structs§
- Compression
Config - Write-side compression policy.
- Compression
Read Result - What
decompress_payloadproduced from a stored payload. - Compression
Write Result - What
compress_payloadchose to store, and why. - Mismatch
Json Diff - The capped built-in difference list and its uncut length.
Enums§
- Protocol
Error - Wire-level failures that are errors rather than misses.
Constants§
- MARKER_
ESCAPED_ RAW - Envelope byte
0x00: the rest is raw serializer output whose own first byte would have collided with a marker. - MARKER_
ZSTD_ BINARY - Envelope byte
0x02: the rest is one zstd frame of binary bytes. - MARKER_
ZSTD_ UTF8 - Envelope byte
0x01: the rest is one zstd frame of UTF-8 text.
Functions§
- ceil_
supported_ cache_ ttl_ ms - Round a write TTL up to whole milliseconds and check the 365-day domain.
- compress_
payload - Compress when the payload meets the threshold and the marked result is strictly smaller than the escaped raw form.
- decode_
frame - Classify one raw read with the protocol’s precedence: absent value, unsupported frame, tracked marker validity and zero stamp, fence, payload encoding, then a hit.
- decompress_
payload - Reverse of
compress_payload, applied to every read. - diff_
shadow_ mismatch_ json - The built-in difference computation over two JSON values.
- encode_
frame - Encode a frame: version byte, big-endian uint64 stamp, encoding tag, payload. Text payloads receive replacement UTF-8 conversion first.
- escape_
raw_ payload - Prefix raw binary output whose first byte would collide with the envelope.
- normalize_
read_ result - The core trust boundary above wire decoding: drop fences on untracked keys or outside the safe domain, and demote a fenced claim without a fence.
- parse_
watermark - Parse a watermark bulk string.
Noneinput is absent (a valid zero baseline);Some(Err)is malformed;Some(Ok(value))is a valid stamp. - read_
result_ from_ untrusted_ json - Interpret an untrusted JSON-shaped semantic reply from a custom adapter. Unknown shapes become unclassified misses; frame-shaped objects ignore stray miss metadata.
- replacement_
utf8 - Decode bytes as UTF-8 with one U+FFFD per maximal ill-formed subpart and no BOM removal (the WHATWG decoder with replacement error handling).
- validate_
timestamp_ ms - A nonnegative safe-integer timestamp.