Expand description
Encoding and decoding of a single WAL object. The byte layout is described in the module documentation.
Structsยง
- Chain
Link ๐ - Names the object another object extends: its sequence and the epoch recorded in its header.
- Encoded
Object ๐ - An encoded object together with the metadata a writer indexes it by.
- Fixed
Trailer ๐ - Fixed-size trailer locating the footer of an object.
- Footer
Entry ๐ - Footer entry describing the segment of one region.
- Header ๐
- Header of a WAL object.
- Reader ๐
- Record ๐
- A single WAL entry inside an object.
Constantsยง
- FOOTER_
ENTRY_ ๐LEN - Length of one footer entry: region id, entry id range, entry count, segment offset, segment length and segment CRC32.
- FORMAT_
VERSION ๐ - HEADER_
LEN ๐ - Length of the object header: magic, version, object sequence, epoch, predecessor sequence, predecessor epoch and the CRC32 of the header.
- HEADER_
MAGIC ๐ - MIN_
OBJECT_ ๐LEN - Lower bound on the length of an object: header, a footer holding only its entry count and the trailer.
- NO_
PREDECESSOR ๐ - Predecessor sequence recorded for an object that starts a chain. Object
sequences stay below
OBJECT_SEQ_LIMIT, so it never names an object. - SEGMENT_
HEADER_ ๐LEN - TRAILER_
LEN ๐ - Length of the fixed trailer: footer offset, footer length, footer CRC32, object CRC32 and magic.
- TRAILER_
MAGIC ๐
Functionsยง
- checksum_
mismatch ๐ - decode_
footer ๐ - Decodes the footer that
trailerpoints at. - decode_
header ๐ - Decodes and verifies the header from the first
HEADER_LENbytes of an object. - decode_
segment ๐ - Decodes the segment that
entrydescribes. - decode_
trailer ๐ - Decodes the trailer from the last
TRAILER_LENbytes of an object. - encode_
footer ๐ - encode_
header ๐ - encode_
object ๐ - Encodes
recordsinto one object. Records are grouped into a segment per region; entry ids within a region must be unique. An object without records only extends the chain. - encode_
trailer ๐ - footer_
range ๐ - Locates the footer inside an object of
object_lenbytes from its trailer. The footer must follow the header and end where the trailer starts. - invalid_
magic ๐ - object_
crc32 ๐ - Checksum of everything but the object checksum itself, so the trailer can carry it.
- to_u32 ๐
- to_u64 ๐
- to_
usize ๐ - trailing_
bytes ๐ - truncated ๐
- verify_
segment_ ๐ranges - Checks that the segments
footerdescribes tile the object body: the first starts right after the header, each follows the previous one without a gap or overlap, and the last ends where the footer atfooter_startbegins.