Module segment

Source
Expand description

Libsql-wal is organized as a linked list of segments. Frames are appended to the head segments, and eventually, the head segment is swapped for a new empty one. The previous head segment is sealed and becomes immutable. The head segment is represented by the CurrentSegment type, and the sealed segments by the SealedSegment type.

When a reader starts a transaction, it record the head segment current frame_no. This is the maximum frame_no that this reader is allowed to read. The reader also keeps a reference to the head segment at the moment it was created.

Modules§

current
list
sealed

Structs§

CheckedFrame
A page with a running runnign checksum prepended. checksum is computed by taking the checksum of the previous frame and crc32’ing it with frame data (header and page content). The first page is hashed with the segment header salt.
Frame
FrameHeader
SegmentFlags
SegmentHeader

Traits§

Segment