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.
v1.14.0 closes the wrap-parity gap against the kevy 3.17 server op
surface: blocking pops (blpop/brpop/bzpopmin), hash field-TTL
(hexpire/hpexpire/hpersist/httl), zset algebra
(zinterstore/zunionstore/zintercard + WEIGHTS/AGGREGATE),
declarative indexes (idx_*), the CDC change feed (feed_*), and
non-atomic Connection::pipeline batching. The full
op-family × wrap-status matrix lives in this crate’s README —
anything listed there as raw-only is still reachable through
Connection::pipeline / Transaction::queue argv passthrough.
Structs§
- Cluster
Client - One open connection per distinct shard node, with a slot → shard index so a single-key command goes straight to its owner.
- Feed
Batch - A batch of change frames plus the cursor to resume from.
- Feed
Frame - One change frame from
Connection::feed_read. - IdxInfo
- One declared index, as reported by
IDX.LIST. - IdxPage
- One page of
IDX.QUERY RANGE/EQresults. - IdxRow
- One
IDX.QUERYhit: the row’s key plus the indexed value’s string form (the same repr the wire carries). - Pipeline
Buf - Client-side command buffer for
Connection::pipeline. EachSelf::cmdappends one RESP-encoded command; the whole buffer is flushed in a single write. - 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.
- HExpire
Cond - Re-exports so downstream code can name the argument/reply types of
the v1.14.0 wraps without adding kevy-embedded / kevy-resp deps.
Condition flags for
HEXPIRE(NX/XX/GT/LT; at most one). - IdxType
- Declared scalar type for
Connection::idx_create_range(TYPE i64|f64|str). Vector/ANN indexes have extra required options — declare those viaConnection::idx_create_raw. - Pubsub
Event - One pubsub frame received from the bus or the wire.
- Reply
- A parsed RESP reply (server → client) — the client-side counterpart of
the crate’s
encode_*functions (server-side encoders). - ZAggregate
- Re-exports so downstream code can name the argument/reply types of
the v1.14.0 wraps without adding kevy-embedded / kevy-resp deps.
AGGREGATEmode for inter/union (Redis 6.2; defaultSum).
Type Aliases§
- HExpire
Code - Re-exports so downstream code can name the argument/reply types of
the v1.14.0 wraps without adding kevy-embedded / kevy-resp deps.
Per-field reply codes for
HEXPIRE-family calls (Redis 7.4):-2key or field missing,0condition (NX/XX/GT/LT) not met,1deadline set,2field deleted (deadline already due). - ZPopHit
(key, member, score)fromConnection::bzpopmin.