Skip to main content

encode_frame_header

Function encode_frame_header 

Source
pub fn encode_frame_header(header: &FrameHeader, buf: &mut [u8])
Expand description

Encode header into the first FRAME_HEADER_SIZE bytes of buf AND compute the per-frame CRC32C covering the frame header (with the CRC field zeroed) plus the page body that follows.

buf.len() must equal FRAME_SIZE; the page body must already have been written into buf[FRAME_HEADER_SIZE..].

Phase 4 (issue #9): on encrypted WALs the CRC is computed over (header_sans_crc + PLAINTEXT body); the caller MUST pass a buffer whose [FRAME_HEADER_SIZE..FRAME_SIZE] slice carries the plaintext body before invoking this helper. Encryption of the body happens AFTER encode_frame_header returns (see Wal::write_frame).