pub fn encode_with_header(
payload: &[u8],
cfg: BlockCompressionConfig,
) -> Result<Vec<u8>, CompressionError>Expand description
Encode payload with the configured codec, prepending the 10-byte
header. Returns the raw payload (no header) when cfg.algo is
None so callers can blindly call this and get back-compat bytes
for free.
Emits a [MyelonInstr] event with ratio + timing the first time the
caller plumbs it through put_kv (the put path passes the metrics
out via the return value so the existing JSON-stream pattern stays
owned by embed.rs).