Skip to main content

encode_snapshot_chunk

Function encode_snapshot_chunk 

Source
pub fn encode_snapshot_chunk(bytes: &[u8]) -> Vec<u8> 
Expand description

Encode one snapshot chunk as a RESP bulk string. Caller is responsible for chunking — typical strategy is fixed SNAPSHOT_CHUNK_MAX-sized reads from a snapshot file or in-memory serializer.

Debug-asserts bytes.len() <= SNAPSHOT_CHUNK_MAX so an accidental oversize chunk trips during development; release builds emit a frame the peer will reject with WireError::BadEnvelope (replica’s decoder caps incoming chunk lengths).