Skip to main content

Module frame

Module frame 

Source
Expand description

TCP wire framing.

Every Kafka TCP message is wrapped in a 4-byte big-endian i32 length prefix. This module provides the encode/decode helpers for that envelope plus a MAX_FRAME_LENGTH cap to prevent OOM on hostile or corrupt input.

Re-exports§

pub use self::error::FrameError;
pub use self::error::FrameErrorKind;

Modules§

error
Error types for crate::frame.

Structs§

RequestFrameSpec
Metadata required to encode a Kafka request frame.
ResponseEnvelope
Decoded Kafka response envelope.

Constants§

MAX_FRAME_LENGTH
Maximum accepted frame payload length (header + body, excluding the 4-byte length prefix itself). Defaults to 100 MiB, matching the Kafka broker’s socket.request.max.bytes default.

Functions§

decode_response_envelope
Parse a Kafka response header once and return the remaining body bytes.
decode_response_frame
Decode one length-prefixed response frame.
encode_request
Encode a request as [i32-BE length][header bytes][body bytes].
encode_request_frame
Encode a Kafka request frame by writing header and body into one buffer.
encode_request_frame_body
Encode a Kafka request frame with an already-encoded request body.
encode_request_frame_body_with_buffer
Encode a Kafka request frame with an already-encoded request body into a caller-supplied buffer.
encode_request_frame_with_buffer
Encode a Kafka request frame into a caller-supplied buffer.
read_frame_length
Read the 4-byte big-endian frame length prefix.
request_frame_capacity_hint
Return the exact buffer capacity needed for a request frame.

Type Aliases§

Result
Result alias for frame operations.