pub fn to_kraft_values(
rec: &MetadataRecord,
image: &MetadataImage,
) -> Result<Vec<Bytes>, TranslateError>Expand description
The engine/snapshot framing entrypoint: translate one MetadataRecord to
the KIP-631 value byte blobs to put on the log.
There is one blob per fanned-out record (most records yield one; whole-map
configs yield one per key plus tombstones, and V1DeleteAccessControlEntry
yields one per matched ACL).
Multi-version metadata records are framed at the version selected by the
image’s finalized metadata.version; every other modeled record frames at
apiVersion 0. Yields an empty Vec when a record fans out to nothing (an
empty config clear with no prior keys, or a delete-ACL filter matching
nothing) — callers treat an all-empty batch as a committed no-op.
A missing finalized metadata.version is treated as the latest supported
level, matching standalone bootstrap. Partition and PartitionChange use
v0, v1, or v2 at the Kafka KIP-858/KIP-966 boundaries. RegisterBroker uses v1,
v2, v3, or v4 at the migration/KIP-858/KIP-1066 boundaries, as Kafka’s
MetadataVersion.registerBrokerRecordVersion does. BrokerRegistrationChange
uses the lowest of v0 to v3 that carries the fields it sets, as Kafka’s
ReplicationControlManager writes it, after dropping log dirs below
3.7-IV2 and cordoned log dirs below 4.3-IV0.
§Errors
Propagates to_kraft_records errors, plus TranslateError::Encode if
the KIP-631 value encoder fails.