Skip to main content

legacy_to_v2

Function legacy_to_v2 

Source
pub fn legacy_to_v2(set_bytes: &[u8]) -> Result<RecordBatch, LegacyRecordsError>
Expand description

Up-convert a v0/v1 MessageSet to a v2 [RecordBatch].

The result is suitable for the log write path. This function sets partition_leader_epoch to -1, which is Kafka’s sentinel for “unknown”. The caller, usually the Produce handler, should overwrite it with the current leader epoch before append.

§Errors

Returns an error if this function cannot decode the legacy message set. Returns an error if offsets exceed the v2 delta fields or timestamp differences exceed i64.