Module journal
Available on crate feature
alloc only.Expand description
Append-only session operation log and its CRC-framed encoding.
Durable session state is built from the parts below. They form a sans-io toolkit that does not use files or async:
JournaledSessionwraps anInMemoryand records every mutation as aOp. The persistence layer chooses how to store those ops, for example as framed bytes in a file or rows in a SQL store.encode_framesturns recorded ops into CRC-framed bytes.Readerdecodes 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 π
- log π
- reader π
- Sans-io journal replay.
StructsΒ§
- Header
- A parsed, supported journal file header.
- Journaled
Session - A
Statewrapper that records every mutation as aOp. - Reader
- Decodes CRC-framed journal records one frame at a time.
EnumsΒ§
- Demand
- Describes what the I/O layer should do next.
- Frame
Error - Error returned when a journal frame cannot be replayed.
- Header
Error - Error returned when a byte sequence is not a valid, supported journal file header.
- Incomplete
Log - The journal could not record an op. The pending ops no longer describe every change.
- Step
- Reports the result of feeding a chunk to the reader.
FunctionsΒ§
- encode_
frames - Encodes
opsas one CRC frame intosink. - snapshot_
ops - Encodes the entire current state of
sessionas a sequence of βstoreβ ops.