Module journal

Module journal 

Expand description

Session journal: async file writer and replay.

The journal stores raw bytes produced by JournaledSession::take_journal. On startup the file is replayed to reconstruct an InMemorySession; during operation new bytes are appended and fsynced after each event-loop iteration.

ยงFile format

file     = header ops*
header   = magic(4) version(1)
magic    = 0x46 0x4D 0x51 0x4A   ("FMQJ")
version  = 0x01
ops      = <raw bytes from JournaledSession>

Structsยง

Writer
Appends journal bytes to a file.

Constantsยง

HEADER_LEN ๐Ÿ”’
MAGIC ๐Ÿ”’
VERSION ๐Ÿ”’

Functionsยง

decode_error_to_io ๐Ÿ”’
replay
Read a journal file and reconstruct an InMemorySession.