Expand description
kevy-client — unified KV facade so downstream code can switch between in-process embedded and TCP-server backends with one URL string.
use kevy_client::Connection;
// Same business code regardless of backend:
let mut conn = Connection::open(std::env::var("MY_KEVY_URL").unwrap().as_str())?;
conn.set(b"hello", b"world")?;
assert_eq!(conn.get(b"hello")?, Some(b"world".to_vec()));URL schemes:
mem://— in-process embedded, in-memory onlymem://<name>— shared in-process bus keyed by<name>file:///abs/path/file://./rel/path— in-process embedded with persistencekevy://host[:port][/db]— TCP RESP, kevy-native schemeredis://host[:port][/db]— TCP RESP, standard Redis URL (alias)tcp://host[:port]— TCP RESP, raw (no SELECT round-trip)
Auth (redis://user:pass@…) and TLS (rediss://) are rejected up front
— kevy ships without either. v1.1.0 added the full string/hash/list/set/
zset + one-shot PUBLISH surface. v1.2.0 added the pub/sub consumer
side as a separate Subscriber type — a subscribed connection cannot
send normal commands, so it needs its own socket and lives outside the
Connection enum. v1.3.0 routes mem://<name> / file:///path through
a process-local registry so the publisher and consumer can find each
other when both opens use the same URL. The trait-vs-enum design
decision is enum for now (closed two-backend universe); see ROADMAP
for the trait extension path.
Structs§
- Subscriber
- One subscribed connection. Owns either a TCP socket or an in-process
Subscription; the variant is chosen by the URL scheme inSubscriber::open/Subscriber::connect. - Subscriber
Events - Iterator returned by
Subscriber::events. Yields every pubsub frame (acks + payloads). See the method docs for termination + error semantics. - Subscriber
Messages - Iterator returned by
Subscriber::messages. Yields one(channel, payload)per publishedmessage/pmessage; ack frames are silently consumed and not yielded. - Transaction
- One in-flight
MULTIblock over aRemoteconnection. - Transaction
Replies - Typed cursor over the per-queued-command replies of a successful
EXEC. Produced byTransaction::exec_typed/Transaction::exec_watched_typed. Eachnext_*consumes one reply; if the variant doesn’t match the extractor, anio::ErrorKind::InvalidDatais returned and the cursor advances regardless (so a downstreamexpect_emptystill works correctly).
Enums§
- Connection
- One open connection to a kevy backend, opaque about whether the backend is in-process or over TCP.
- Pubsub
Event - One pubsub frame received from the bus or the wire.