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§
- Request
Frame Spec - Metadata required to encode a Kafka request frame.
- Response
Envelope - 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.bytesdefault.
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.