Skip to main content

Module buffer

Module buffer 

Source
Expand description

File-based event buffer for offline reliability.

Events are stored as JSON files in a buffer directory when the transport is unavailable, then replayed when connectivity is restored.

Each file is a unit: one send batch, so a Merkle-signed batch (#392) stays together with the statement and proofs its events carry. Events are signed before they are buffered, so editing a buffered event breaks its signature or proof. Unit names carry a zero-padded timestamp and counter, and units are read back in the order written, so replay can forward them strictly in order (#395). An unreadable unit is moved to rejected/ so it cannot block the queue.

Structsยง

BufferedEvent
A buffered event with its file path.
BufferedUnit
One buffered unit: the events written together, in order.
FileBuffer
File-based event buffer.