Skip to main content

Crate kevy_cluster_rw

Crate kevy_cluster_rw 

Source
Expand description

kevy-cluster-rw — read/write-split cluster client for kevy.

Splits each client command between a primary connection (for writes — keyspace-mutating verbs) and a fleet of replica connections (for reads — round-robin across them, fallback to the primary when no replica is configured). A per-command consistent: bool knob (READCONSISTENT semantics) forces a read to the primary for callers that need fresh data.

v1.18 model: the operator supplies the primary address + a list of replica addresses to ReadWriteClient::connect; the client holds one RespClient per node. Server-side classification is intentionally not consulted (no implicit CLUSTER SLOTS walk); this keeps the client correct under both [cluster] enabled and standalone deployments.

Per-command read/write classification lives in is_write_verb — a small static table mirroring kevy::cmd’s server-side rule (duplicated here on purpose: this crate is downstream of kevy-resp-client only, so it never depends on the server crate).

Structs§

ReadWriteClient
Read/write-split cluster client. Owns one RespClient to the primary node + one per replica node. Round-robins reads across the replica fleet (fallback to primary on empty fleet or consistent = true).

Functions§

is_write_verb
true when verb is a keyspace-mutating command and so must run against the primary. Otherwise the command is read-side and a replica can serve it.