Segment record framing. encode/1 packs many records into one immutable
segment binary and returns a per-record index (byte offset + length within the
segment). A single range GET on the blob store then reads exactly one record,
which decode_record/1 validates and unframes.
Ankusa.Storage.Segment wraps what encode/1 returns in the segment header
and sha256 trailer, and shifts the offsets past the header; a codec only frames
records. It may export id/0, the one-byte id the header records for it (1 is
Ankusa.Codec.Raw); without one the header says 0 and the catalogue row names
the module.
Summary
Types
@type index_entry() :: %{ key: String.t(), offset: non_neg_integer(), length: pos_integer() }
Callbacks
@callback encode([segment_record()]) :: {segment :: binary(), index :: [index_entry()]}
@callback id() :: 1..255