Skip to main content

Crate kevy_client

Crate kevy_client 

Source
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 only
  • mem://<name> — shared in-process bus keyed by <name>
  • file:///abs/path / file://./rel/path — in-process embedded with persistence
  • kevy://host[:port][/db] — TCP RESP, kevy-native scheme
  • redis://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 in Subscriber::open / Subscriber::connect.
SubscriberEvents
Iterator returned by Subscriber::events. Yields every pubsub frame (acks + payloads). See the method docs for termination + error semantics.
SubscriberMessages
Iterator returned by Subscriber::messages. Yields one (channel, payload) per published message / pmessage; ack frames are silently consumed and not yielded.
Transaction
One in-flight MULTI block over a Remote connection.
TransactionReplies
Typed cursor over the per-queued-command replies of a successful EXEC. Produced by Transaction::exec_typed / Transaction::exec_watched_typed. Each next_* consumes one reply; if the variant doesn’t match the extractor, an io::ErrorKind::InvalidData is returned and the cursor advances regardless (so a downstream expect_empty still works correctly).

Enums§

Connection
One open connection to a kevy backend, opaque about whether the backend is in-process or over TCP.
PubsubEvent
One pubsub frame received from the bus or the wire.