Expand description
Append-only framed journal.
Persistence is kept orthogonal to serialization. The journal moves opaque
[u32-LE length][payload] frames to and from a file and handles the durability
concerns — append, fsync, and recovery of a torn trailing frame after a crash.
How a record turns into a payload is entirely the FrameCodec’s business, so
the Raft log store can frame protobuf while the WAL engine frames JSON over the
exact same code.
Structs§
- Journal
Writer - An append handle over a single journal file.
- Json
Codec - JSON frame codec for any owned, serde-serializable record.
Traits§
- Frame
Codec - Serialization seam: how one record becomes a frame payload and back.
Functions§
- decode_
frames - Decode framed records from an in-memory buffer, returning the records and the byte length of the valid (fully-written) prefix. A torn trailing frame ends the scan.
- replay
- Read every record from
path, decoding withC. A torn trailing frame left by a crash mid-write is truncated away and ignored, leaving the file at its last clean record boundary. - replay_
each - Stream every valid record from
paththroughvisitwithout retaining the entire journal in memory. A torn trailing frame is truncated with the same recovery semantics asreplay. - truncate_
to - Truncate
pathtovalid_lenbytes, dropping a torn trailing frame, thenfsync.