Optional physical compression of canonical storage bytes.
Compression is below the ledger format: decompression returns the exact original bytes, so Entry digests, exports and idempotency do not change. Small/incompressible values stay unwrapped. Readers accept both forms, allowing a host to change its write policy without rewriting old records.
The envelope declares the decoded size and its SHA-256 checksum. Neither is trusted: inflation proceeds in small chunks under the caller's byte limit, and the actual size/checksum are checked before canonical decoding. This checksum detects damage; it is not an authenticity signature.
Summary
Functions
Compresses storage bytes only when enabled and smaller, without changing canonical identity.
Returns exact original bytes within the caller's limit, rejecting corrupt or oversized envelopes.
Functions
Compresses storage bytes only when enabled and smaller, without changing canonical identity.
@spec unpack(binary(), pos_integer()) :: {:ok, binary()} | {:error, term()}
Returns exact original bytes within the caller's limit, rejecting corrupt or oversized envelopes.