Skip to main content

Crate crabka_protocol

Crate crabka_protocol 

Source
Expand description

Kafka wire-protocol codec.

crabka-protocol is a pure-Rust library that encodes and decodes every Apache Kafka request and response message, byte-equivalent to the upstream JVM implementation. It performs no I/O and makes no async assumptions; it is intended to be consumed by broker, client, and tooling crates within the Crabka project.

§Two flavors

Every message has two generated types:

  • owned::FooRequest — owns its data (String, Bytes, Vec<T>). Easy to move across await points.
  • borrowed::FooRequest<'a> — references slices of the input buffer (&'a str, &'a [u8]). Zero-copy decoding.

Both implement Encode; the owned flavor implements Decode and the borrowed flavor implements DecodeBorrow.

§Versioning

crabka-protocol is pre-1.0. Breaking API changes per minor version are allowed; see CHANGELOG.md. The wire-protocol pin is recorded in crates/protocol/schemas/VERSION.

Re-exports§

pub use api_key::ApiKey;
pub use tagged_fields::UnknownTaggedField;
pub use tagged_fields::UnknownTaggedFields;

Modules§

api_key
borrowed
Borrowed-flavor generated message types.
kafka_3_6_2
legacy_compat
Adapters between the canonical Produce/Fetch types and the kafka_3_6_2-namespaced flavors emitted from the vendored 3.6.2 schemas. Used by the wire-router branches for Produce v0–2 and Fetch v0–3.
owned
Owned (heap-allocated) message types.
primitives
records
Typed v2 record batch decoder/encoder.
tagged_fields
KIP-482 flexible-version tagged fields.

Enums§

ProtocolError
Errors that can occur during wire-protocol encoding or decoding.

Traits§

Decode
Decode a Kafka wire-protocol value from a buffer at the given protocol version.
DecodeBorrow
Like Decode, but for borrowed (zero-copy) flavors. Requires a contiguous buffer because borrowed values reference slices of it.
Encode
Encode a Kafka wire-protocol value into a buffer at the given protocol version.
ProtocolRequest
Implemented by every generated Request struct in crabka-protocol.