pub enum ShardRequest {
Show 95 variants
Get {
key: String,
},
Set {
key: String,
value: Bytes,
expire: Option<Duration>,
nx: bool,
xx: bool,
},
Incr {
key: String,
},
Decr {
key: String,
},
IncrBy {
key: String,
delta: i64,
},
DecrBy {
key: String,
delta: i64,
},
IncrByFloat {
key: String,
delta: f64,
},
Append {
key: String,
value: Bytes,
},
Strlen {
key: String,
},
GetRange {
key: String,
start: i64,
end: i64,
},
SetRange {
key: String,
offset: usize,
value: Bytes,
},
Keys {
pattern: String,
},
Rename {
key: String,
newkey: String,
},
Copy {
source: String,
destination: String,
replace: bool,
},
ObjectEncoding {
key: String,
},
Del {
key: String,
},
Unlink {
key: String,
},
Exists {
key: String,
},
RandomKey,
Touch {
key: String,
},
Sort {
key: String,
desc: bool,
alpha: bool,
limit: Option<(i64, i64)>,
},
Expire {
key: String,
seconds: u64,
},
Ttl {
key: String,
},
Persist {
key: String,
},
Pttl {
key: String,
},
Pexpire {
key: String,
milliseconds: u64,
},
LPush {
key: String,
values: Vec<Bytes>,
},
RPush {
key: String,
values: Vec<Bytes>,
},
LPop {
key: String,
},
RPop {
key: String,
},
BLPop {
key: String,
waiter: Sender<(String, Bytes)>,
},
BRPop {
key: String,
waiter: Sender<(String, Bytes)>,
},
LRange {
key: String,
start: i64,
stop: i64,
},
LLen {
key: String,
},
LIndex {
key: String,
index: i64,
},
LSet {
key: String,
index: i64,
value: Bytes,
},
LTrim {
key: String,
start: i64,
stop: i64,
},
LInsert {
key: String,
before: bool,
pivot: Bytes,
value: Bytes,
},
LRem {
key: String,
count: i64,
value: Bytes,
},
LPos {
key: String,
element: Bytes,
rank: i64,
count: usize,
maxlen: usize,
},
Type {
key: String,
},
ZAdd {
key: String,
members: Vec<(f64, String)>,
nx: bool,
xx: bool,
gt: bool,
lt: bool,
ch: bool,
},
ZRem {
key: String,
members: Vec<String>,
},
ZScore {
key: String,
member: String,
},
ZRank {
key: String,
member: String,
},
ZRevRank {
key: String,
member: String,
},
ZCard {
key: String,
},
ZRange {
key: String,
start: i64,
stop: i64,
with_scores: bool,
},
ZRevRange {
key: String,
start: i64,
stop: i64,
with_scores: bool,
},
ZCount {
key: String,
min: ScoreBound,
max: ScoreBound,
},
ZIncrBy {
key: String,
increment: f64,
member: String,
},
ZRangeByScore {
key: String,
min: ScoreBound,
max: ScoreBound,
offset: usize,
count: Option<usize>,
},
ZRevRangeByScore {
key: String,
min: ScoreBound,
max: ScoreBound,
offset: usize,
count: Option<usize>,
},
ZPopMin {
key: String,
count: usize,
},
ZPopMax {
key: String,
count: usize,
},
HSet {
key: String,
fields: Vec<(String, Bytes)>,
},
HGet {
key: String,
field: String,
},
HGetAll {
key: String,
},
HDel {
key: String,
fields: Vec<String>,
},
HExists {
key: String,
field: String,
},
HLen {
key: String,
},
HIncrBy {
key: String,
field: String,
delta: i64,
},
HKeys {
key: String,
},
HVals {
key: String,
},
HMGet {
key: String,
fields: Vec<String>,
},
SAdd {
key: String,
members: Vec<String>,
},
SRem {
key: String,
members: Vec<String>,
},
SMembers {
key: String,
},
SIsMember {
key: String,
member: String,
},
SCard {
key: String,
},
SUnion {
keys: Vec<String>,
},
SInter {
keys: Vec<String>,
},
SDiff {
keys: Vec<String>,
},
SUnionStore {
dest: String,
keys: Vec<String>,
},
SInterStore {
dest: String,
keys: Vec<String>,
},
SDiffStore {
dest: String,
keys: Vec<String>,
},
SRandMember {
key: String,
count: i64,
},
SPop {
key: String,
count: usize,
},
SMisMember {
key: String,
members: Vec<String>,
},
DbSize,
Stats,
KeyVersion {
key: String,
},
Snapshot,
SerializeSnapshot,
RewriteAof,
FlushDb,
FlushDbAsync,
Scan {
cursor: u64,
count: usize,
pattern: Option<String>,
},
SScan {
key: String,
cursor: u64,
count: usize,
pattern: Option<String>,
},
HScan {
key: String,
cursor: u64,
count: usize,
pattern: Option<String>,
},
ZScan {
key: String,
cursor: u64,
count: usize,
pattern: Option<String>,
},
CountKeysInSlot {
slot: u16,
},
GetKeysInSlot {
slot: u16,
count: usize,
},
DumpKey {
key: String,
},
RestoreKey {
key: String,
ttl_ms: u64,
data: Bytes,
replace: bool,
},
}Expand description
A protocol-agnostic command sent to a shard.
Variants§
Get
Set
Fields
Incr
Decr
IncrBy
DecrBy
IncrByFloat
Append
Strlen
GetRange
SetRange
Keys
Returns all keys matching a glob pattern in this shard.
Rename
Renames a key within this shard.
Copy
Copies the value at source to destination within this shard.
ObjectEncoding
Returns the internal encoding name for the value at key.
Del
Unlink
Like DEL but defers value deallocation to the background drop thread.
Exists
RandomKey
Returns a random key from the shard’s keyspace.
Touch
Updates last access time for a key. Returns bool (existed).
Sort
Sorts elements from a list, set, or sorted set in this shard.
Expire
Ttl
Persist
Pttl
Pexpire
LPush
RPush
LPop
RPop
BLPop
Blocking left-pop. If the list has elements, pops immediately and sends
the result on waiter. If empty, the shard registers the waiter to be
woken when an element is pushed. Uses an mpsc sender so multiple shards
can race to deliver the first result to a single receiver.
BRPop
Blocking right-pop. Same semantics as BLPop but pops from the tail.
LRange
LLen
LIndex
LSet
LTrim
LInsert
LRem
LPos
Type
ZAdd
ZRem
ZScore
ZRank
ZRevRank
ZCard
ZRange
ZRevRange
ZCount
ZIncrBy
ZRangeByScore
ZRevRangeByScore
ZPopMin
ZPopMax
HSet
HGet
HGetAll
HDel
HExists
HLen
HIncrBy
HKeys
HVals
HMGet
SAdd
SRem
SMembers
SIsMember
SCard
SUnion
SInter
SDiff
SUnionStore
SInterStore
SDiffStore
SRandMember
SPop
SMisMember
DbSize
Returns the key count for this shard.
Stats
Returns keyspace stats for this shard.
KeyVersion
Returns the current version of a key for WATCH optimistic locking. Read-only, no AOF, no replication — cold path only.
Snapshot
Triggers a snapshot write.
SerializeSnapshot
Serializes the current shard state to bytes (in-memory snapshot).
Used by the replication server to capture a consistent shard snapshot for transmission to a new replica without filesystem I/O.
RewriteAof
Triggers an AOF rewrite (snapshot + truncate AOF).
FlushDb
Clears all keys from the keyspace.
FlushDbAsync
Clears all keys, deferring deallocation to the background drop thread.
Scan
Scans keys in the keyspace.
SScan
Incrementally iterates set members.
HScan
Incrementally iterates hash fields.
ZScan
Incrementally iterates sorted set members.
CountKeysInSlot
Counts keys in this shard that hash to the given cluster slot.
GetKeysInSlot
Returns up to count keys that hash to the given cluster slot.
DumpKey
Dumps a key’s value as serialized bytes for MIGRATE.
RestoreKey
Restores a key from serialized bytes (received via MIGRATE).