Skip to main content

decode_producer_snapshot

Function decode_producer_snapshot 

Source
pub fn decode_producer_snapshot(
    bytes: &[u8],
    snapshot_offset: Offset,
) -> Result<HashMap<ProducerId, ProducerSnapshotEntry>, SnapshotDecodeError>
Expand description

Decode a Kafka v1 producer-state .snapshot taken at snapshot_offset, the exclusive log frontier its entries must lie strictly before.

The checks run in Kafka’s ProducerStateManager.readSnapshot order: framing (header, version, entry count against the input length), then the CRC32C, then each entry’s legality and producer-ID uniqueness.

§Errors

Returns the SnapshotDecodeError of the first check that fails.