1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! Kafka wire-protocol codec.
//!
//! `krabka-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 does no I/O and makes no async assumptions. The
//! broker, client, and tooling crates in the Krabka project use it.
//!
//! ## Two flavors
//!
//! Every message has two generated types:
//!
//! - `owned::FooRequest` owns its data as `String`, `Bytes`, and `Vec<T>`.
//! It is easy to move across `await` points.
//! - `borrowed::FooRequest<'a>` references slices of the input buffer as
//! `&'a str` and `&'a [u8]`. It decodes with zero copies.
//!
//! Both implement [`Encode`]. The owned flavor implements [`Decode`] and the
//! borrowed flavor implements [`DecodeBorrow`].
//!
//! ## Krabka-private messages
//!
//! [`krabka`] holds the hand-written messages that Apache Kafka does not define.
//! Their api keys sit at 1000 and above, so a later Kafka assignment cannot
//! collide with them.
//!
//! ## Versioning
//!
//! `krabka-protocol` is pre-1.0. Breaking API changes are allowed per minor
//! version. See CHANGELOG.md. `crates/protocol/schemas/VERSION` records the
//! wire-protocol pin.
//!
//! ## Encoding a generated request
//!
//! ```rust
//! use bytes::BytesMut;
//! use krabka_protocol::{Encode, owned::api_versions_request::ApiVersionsRequest};
//!
//! let req = ApiVersionsRequest::default();
//! let version = 4;
//! let mut buf = BytesMut::with_capacity(req.encoded_len(version));
//! req.encode(&mut buf, version).unwrap();
//! assert_eq!(buf.len(), req.encoded_len(version));
//! ```
pub use ApiKey;
pub use ;
pub use ProtocolError;
pub use RemoteLogMetadataRecord;
pub use ;