Expand description
The client, written once and generic over its sockets.
barnabas_core holds the parts with no IO at all — framing, correlation,
filtering, the producer’s sequencing rules. This crate holds the part that
sends: connection pooling, leader routing, metadata refresh, the
consumer’s fetch loop and the producer’s transaction flow. All of it is
generic over one small Transport, so a runtime binding supplies four
functions and nothing else.
§Why the seam is four functions
The first version of this crate did not exist: barnabas-glommio held all
1368 lines of it. That made the design’s claim — “bindings are ~300 lines”
— false, and would have made a second binding a copy of the first, with the
usual consequence that the two drift and only one gets the bug fix.
So the split is by what actually differs between runtimes, which turns out to be: open a socket, read, write, sleep. Everything above that is protocol and is identical everywhere.
§No Send bounds, deliberately
Nothing here requires Send, on the futures or on the transport. That is
what lets a thread-per-core binding hold !Send sockets while a
work-stealing binding hands out a handle usable across threads — the
binding decides, and neither choice is imposed by this crate.
An abstraction that required Send here would forbid the per-core case
outright, which is exactly the lowest-common-denominator failure that made
a runtime trait the wrong shape for slipstream-rt (see that crate’s
RtCtx). The difference is that this trait abstracts over sockets, not
over runtimes: it never spawns, never names an executor, and has nothing to
lose by staying bound-free.
Re-exports§
pub use admin::Admin;pub use admin::BrokerInfo;pub use admin::NewTopic;pub use builder::ConsumerBuilder;pub use builder::ProducerBuilder;pub use builder::StartOffset;pub use cluster::Cluster;pub use consumer::Consumer;pub use consumer::ConsumerRecords;pub use consumer::RebalanceListener;pub use consumer::RecordRef;pub use consumer::EARLIEST;pub use consumer::LATEST;pub use group::ClassicProtocol;pub use group::GroupMetadata;pub use group::GroupProtocol;pub use group::Membership;pub use producer::Producer;pub use producer::ProducerRecord;pub use sasl::Credentials;pub use sasl::SaslMechanism;
Modules§
- admin
- The admin client: enough to create a topic, inspect a cluster, and trim a log — no more.
- builder
- Staged builders, so the type says what is still missing.
- cluster
- Connections to brokers, and the routing that decides which one to use.
- consumer
- The assign-only consumer.
- group
- The group protocol on a socket: the classic one, behind the seam.
- producer
- The transactional producer: requests, routing, and retries.
- sasl
- SASL authentication: PLAIN and SCRAM-SHA-256/512.
Enums§
Traits§
- Transport
- What a runtime must provide: a socket and a timer.