View Source kpro_batch (kafka_protocol v4.1.10)

Summary

Functions

Decode received message-set into a batch list. Ensured by kpro:decode_batches/1, the input binary should contain at least one mssage.
Encode a list of batch inputs into byte stream.
Encode a batch of magic version 2. RecordBatch => FirstOffset => int64 Length => int32 PartitionLeaderEpoch => int32 # client set whatever Magic => int8 # The 17th byte as in v0 and v1 CRC => int32 Attributes => int16 LastOffsetDelta => int32 FirstTimestamp => int64 MaxTimestamp => int64 ProducerId => int64 ProducerEpoch => int16 FirstSequence => int32 Records => [Record]
Return true if it is a control batch.

Types

-type batch_input() :: kpro:batch_input().
-type batch_meta() :: kpro:batch_meta().
-type compress_option() :: kpro:compress_option().
-type headers() :: kpro:headers().
-type magic() :: kpro:magic().
-type message() :: kpro:message().
-type msg_input() :: kpro:msg_input().
-type msg_ts() :: kpro:msg_ts().
-type offset() :: kpro:offset().
-type seqno() :: kpro:seqno().
-type ts_type() :: kpro:timestamp_type().
-type txn_ctx() :: kpro:txn_ctx().

Functions

-spec decode(binary()) -> [{batch_meta(), [message()]}].
Decode received message-set into a batch list. Ensured by kpro:decode_batches/1, the input binary should contain at least one mssage.
Link to this function

encode(MagicVsn, Batch, Compression)

View Source
-spec encode(magic(), batch_input(), compress_option()) -> iodata().
Encode a list of batch inputs into byte stream.
Link to this function

encode_tx(Batch, Compression, FirstSequence, _)

View Source
-spec encode_tx(batch_input(), compress_option(), seqno(), txn_ctx()) -> iodata().
Encode a batch of magic version 2. RecordBatch => FirstOffset => int64 Length => int32 PartitionLeaderEpoch => int32 # client set whatever Magic => int8 # The 17th byte as in v0 and v1 CRC => int32 Attributes => int16 LastOffsetDelta => int32 FirstTimestamp => int64 MaxTimestamp => int64 ProducerId => int64 ProducerEpoch => int16 FirstSequence => int32 Records => [Record]
-spec is_control(batch_meta()) -> boolean().
Return true if it is a control batch.