Module journal
Available on crate feature
alloc only.Expand description
Append-only session operation log and its CRC-framed encoding.
This module provides the building blocks for durable session state. It is organised as a sans-io toolkit with no knowledge of files or async:
JournaledSessionwraps anInMemorySessionand records every mutation as aSessionOp. The persistence layer decides how to store those ops: framed bytes for a file, rows for a SQL store.encode_framesturns recorded ops into CRC-framed bytes.JournalReaderdecodes those bytes one frame at a time, either streaming from external storage or in-memory.Headeris the file-level header that identifies the on-disk format version, written once before any frames.
ModulesΒ§
- crc32 π
- CRC-32/ISO-HDLC (IEEE 802.3) checksum.
- encode π
- frame π
- header π
- reader π
- Sans-io journal replay.
StructsΒ§
- Header
- A parsed, supported journal file header.
- Journal
Reader - Decodes CRC-framed journal records one frame at a time.
- Journaled
Session - A
SessionStatewrapper that records every mutation as aSessionOp.
EnumsΒ§
- Demand
- Describes what the I/O layer should do next.
- Header
Error - Why a byte sequence is not a valid, supported journal file header.
- Journal
Frame Error - Error returned when a journal frame cannot be decoded.
- Step
- Reports the result of feeding a chunk to the reader.
FunctionsΒ§
- encode_
frames - Encodes
opsas a single CRC frame, appending it toout. - snapshot_
ops - Encodes the entire current state of
sessionas a sequence of βstoreβ ops.