Ankusa.Codec.Raw (ankusa v0.7.0)

Copy Markdown View Source

Default Ankusa.Codec: length-prefixed, CRC-checked framing with no compression.

Each record is framed as:

<<len::32, crc32::32, payload::binary>>

where crc32 = :erlang.crc32(payload) covers the payload only. encode/1 concatenates the frames into one segment binary and returns a per-record index of {key, offset, length} — offset is the frame start byte within the segment and length is the full frame length (payload plus the 8-byte header), exactly the byte range Ankusa.BlobStore.get_range/5 must fetch for decode_record/1. The offsets are relative to the first frame; the segment header (Ankusa.Storage.Segment) shifts them when it wraps the frames.