Skip to main content

Module format

Module format 

Source
Expand description

Encoding and decoding of a single WAL object. The byte layout is described in the module documentation.

Structsยง

ChainLink ๐Ÿ”’
Names the object another object extends: its sequence and the epoch recorded in its header.
EncodedObject ๐Ÿ”’
An encoded object together with the metadata a writer indexes it by.
FixedTrailer ๐Ÿ”’
Fixed-size trailer locating the footer of an object.
FooterEntry ๐Ÿ”’
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 trailer points at.
decode_header ๐Ÿ”’
Decodes and verifies the header from the first HEADER_LEN bytes of an object.
decode_segment ๐Ÿ”’
Decodes the segment that entry describes.
decode_trailer ๐Ÿ”’
Decodes the trailer from the last TRAILER_LEN bytes of an object.
encode_footer ๐Ÿ”’
encode_header ๐Ÿ”’
encode_object ๐Ÿ”’
Encodes records into 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_len bytes 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 footer describes 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 at footer_start begins.