View Source ExWal.Models.LegacyRecord (ex_wal v0.3.0)
The wire format is that the stream is divided into 32KiB blocks, and each block contains a number of tightly packed chunks. Chunks cannot cross block boundaries. The last block may be shorter than 32 KiB. Any unused bytes in a block must be zero.
A record maps to one or more chunks. There are two chunk formats: legacy and recyclable. The legacy chunk format:
+----------+-----------+-----------+--- ... ---+ | CRC (4B) | Size (2B) | Type (1B) | Payload | +----------+-----------+-----------+--- ... ---+
CRC is computed over the type and payload Size is the length of the payload in bytes Type is the chunk type
There are four chunk types: whether the chunk is the full record, or the first, middle or last chunk of a multi-chunk record. A multi-chunk record has one first chunk, zero or more middle chunks, and one last chunk.
Summary
Types
@type t() :: %ExWal.Models.LegacyRecord{ crc: non_neg_integer(), payload: binary(), size: non_neg_integer(), type: non_neg_integer() }