Skip to main content

from_kraft

Function from_kraft 

Source
pub fn from_kraft(
    rec: &KraftMetadataRecord,
    image: &MetadataImage,
) -> Result<MetadataRecord, TranslateError>
Expand description

Convert one KIP-631 record back to its MetadataRecord counterpart.

Inverse of to_kraft. A Config record routes back to V1TopicConfig or V1BrokerConfig by resource_type. Topic-config records decode to single-key singletons that the image merges.

§Errors

TranslateError::UnknownTopicId when a topic or partition references a topic id absent from image, TranslateError::NoCounterpart for records this layer does not model, TranslateError::InvalidValue for out-of-range enum values, negative ids, unparsable strings and a directory list whose length does not match the replicas in the same record, and TranslateError::InvalidReference for a partition change that the image cannot apply: an unknown partition, a directory list whose length does not match the image’s replicas, or an epoch already at its maximum.