Skip to main content

encode

Function encode 

Source
pub fn encode(event: &WalEvent) -> Result<Vec<u8>, EncodeError>
Expand description

Encodes a WAL event into bytes.

The encoding includes:

  • A 4-byte version header
  • A 4-byte length frame
  • A 4-byte CRC-32 checksum of the payload
  • The postcard-serialized event payload

§Determinism

This function produces deterministic output - the same event will always produce the same bytes. This is critical for replay and recovery.

§Errors

Returns EncodeError::Serialization if the event cannot be serialized.