Expand description
Translate Krabka’s internal MetadataRecord currency to and from the
KIP-631 [KraftMetadataRecord] wire shape, so the controller log and
snapshots are genuinely KIP-631-framed.
The conversion is not a pure field rename. Several Krabka records
carry state that the KIP-631 records do not, and the reverse also holds.
This module bridges the gap and defaults the KIP-631 extras that Krabka
does not model. The round-trip
rec -> to_kraft(&image) -> from_kraft(&image) == rec is the
correctness bar for every modeled variant.
§Variants with no faithful KIP-631 counterpart
V1VotersandV1KRaftVersionare KIP-853 raft control records and not metadata records. They have no entry in the [KraftMetadataRecord] dispatch, and nothing submits them through the translation boundary, soto_kraftreturnsTranslateError::NoCounterpartfor them.
§Fan-out / image-keyed mappings
V1TopicConfigis whole-map authoritative, and KIP-631 has only per-keyConfigRecords.to_kraft_recordsdiffs the new map against the current overrides of the image. It emits a set per present key plus a tombstone (value: None) per dropped key.from_kraftmerges the delta of one key back onto the image map and re-emits the whole map, so the replace semantics ofMetadataImage::applystay unchanged. Records must apply in log order against a live image.V1DeleteAccessControlEntry(AclEntryFilter): KIP-631’sRemoveAccessControlEntryRecorddeletes byid: Uuidonly. Krabka does not model ACL ids, soto_kraft_recordsresolves the filter against the image to the matching entries and emits oneRemoveAccessControlEntryper match, keyed by a deterministic content-hash id. That is the same id that the add path stamps.from_kraftrescans the image by that hash to recover the entry and emit a pinned filter. This is self-consistent within Krabka.
§Lossy / awkward mappings (documented)
RegisterBroker: Krabka stores a top-level(host, port)plus a per-listenerendpointslist; KIP-631 has onlyend_points(no top-level host/port). When listeners exist, their first entry supplies the legacy top-level pair on decode. A legacy Krabka record with no listeners uses one empty-name compatibility entry.broker_epoch,incarnation_id,features,log_dirs,fenced,in_controlled_shutdownandcordoned_log_dirsare carried; the ZK migration flag is dropped.DelegationToken:KafkaPrincipals map through theirType:Namestring form.
Enums§
Constants§
- PRIVATE_
RECORD_ VERSION - The version of a krabka-private
NoOpRecordtag body, the big-endiani16in front of the wincodeMetadataRecord. It is part of the krabka 1.x on-disk contract.
Functions§
- from_
kraft - Convert one KIP-631 record back to its
MetadataRecordcounterpart. - from_
kraft_ value - The inverse framing entrypoint.
- to_
kraft - Convert a single
MetadataRecordto its KIP-631 counterpart. - to_
kraft_ records - Convert a single
MetadataRecordto one or more KIP-631 records. - to_
kraft_ values - The engine/snapshot framing entrypoint: translate one
MetadataRecordto the KIP-631 value byte blobs to put on the log.