Skip to main content

serialize_bootstrap_snapshot

Function serialize_bootstrap_snapshot 

Source
pub fn serialize_bootstrap_snapshot(
    kraft_version: u16,
    voters: &VoterSet,
    records: &[MetadataRecord],
    last_contained_log_timestamp: i64,
) -> Result<Bytes, RaftError>
Expand description

Serialize the bootstrap checkpoint of a dynamic format, as Kafka’s Formatter.writeBoostrapSnapshot writes it: the KIP-853 kraft.version and voter set, then the bootstrap records in their own order.

A controller does not apply these records to its image. The active controller writes them to an empty metadata log, and every replica applies them from there.

§Errors

Returns an error if kraft_version exceeds int16, or if a voter or a bootstrap record cannot be encoded.