Skip to main content

Module segment

Module segment 

Source
Expand description

Tailing wal.bin: the next byte range to ship, in whole frames.

A WAL frame is [len: u32 LE][crc32: u32 LE][payload: len bytes] (core_storage::wal::encode_record). A segment always ends on a frame boundary, so concatenating a generation’s segments in offset order is a valid WAL.

Structs§

FrameCounter
Counts frames in a WAL read in arbitrary chunks, by their headers.

Constants§

FRAME_HEADER_LEN
Frame header: len then crc32, both u32 little-endian.
MAX_SEGMENT_BYTES
Most bytes one call reads, unless a single frame is larger. A WAL that grew by more than this since the last tick ships over several segments.

Functions§

complete_frames
The prefix of bytes made of whole, checksum-valid frames: its length and how many frames it holds.
read_new_segment
The next segment of wal_path to ship: bytes from from_byte up to at most durable_len, cut back to the last complete frame.