Skip to main content

encode_compressed_message_set

Function encode_compressed_message_set 

Source
pub fn encode_compressed_message_set<B: BufMut>(
    records: &[ParsedRecord],
    magic: Magic,
    codec: CompressionType,
    buf: &mut B,
) -> Result<(), LegacyRecordsError>
Expand description

Encode a MessageSet wrapped in a single compressed outer message.

The inner set is uncompressed and contains one message per record. It follows the KIP-32 conventions: v1 inner offsets are relative to the first record, preserving gaps left by compaction.

ยงErrors

Returns Malformed if codec is CompressionType::Zstd, which v0/v1 cannot represent. Returns Malformed if a v1 relative offset exceeds i64. Returns a compression error if the codec cannot compress the inner set.