pub enum ShardRequest {
Show 126 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,
},
GetBit {
key: String,
offset: u64,
},
SetBit {
key: String,
offset: u64,
value: u8,
},
BitCount {
key: String,
range: Option<BitRange>,
},
BitPos {
key: String,
bit: u8,
range: Option<BitRange>,
},
BitOp {
op: BitOpKind,
dest: String,
keys: Vec<String>,
},
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,
},
MemoryUsage {
key: String,
},
Persist {
key: String,
},
Pttl {
key: String,
},
Pexpire {
key: String,
milliseconds: u64,
},
Expireat {
key: String,
timestamp: u64,
},
Pexpireat {
key: String,
timestamp_ms: u64,
},
LPush {
key: String,
values: Vec<Bytes>,
},
RPush {
key: String,
values: Vec<Bytes>,
},
LPop {
key: String,
},
RPop {
key: String,
},
LPopCount {
key: String,
count: usize,
},
RPopCount {
key: String,
count: usize,
},
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,
},
LmpopSingle {
key: String,
left: bool,
count: usize,
},
ZmpopSingle {
key: String,
min: bool,
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,
},
HIncrByFloat {
key: String,
field: String,
delta: f64,
},
HKeys {
key: String,
},
HVals {
key: String,
},
HMGet {
key: String,
fields: Vec<String>,
},
HRandField {
key: String,
count: Option<i64>,
with_values: bool,
},
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>,
},
SMove {
source: String,
destination: String,
member: String,
},
SInterCard {
keys: Vec<String>,
limit: usize,
},
Expiretime {
key: String,
},
Pexpiretime {
key: String,
},
LMove {
source: String,
destination: String,
src_left: bool,
dst_left: bool,
},
GetDel {
key: String,
},
GetSet {
key: String,
value: Bytes,
},
MSetNx {
pairs: Vec<(String, Bytes)>,
},
GetEx {
key: String,
expire: Option<Option<u64>>,
},
ZDiff {
keys: Vec<String>,
},
ZInter {
keys: Vec<String>,
},
ZUnion {
keys: Vec<String>,
},
ZDiffStore {
dest: String,
keys: Vec<String>,
},
ZInterStore {
dest: String,
keys: Vec<String>,
},
ZUnionStore {
dest: String,
keys: Vec<String>,
},
ZRandMember {
key: String,
count: Option<i64>,
with_scores: bool,
},
DbSize,
Stats,
KeyVersion {
key: String,
},
UpdateMemoryConfig {
max_memory: Option<usize>,
eviction_policy: EvictionPolicy,
},
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
GetBit
GETBIT key offset. Returns the bit at offset (0 or 1). Big-endian ordering.
SetBit
SETBIT key offset value. Sets the bit at offset to 0 or 1. Returns old bit.
BitCount
BITCOUNT key [range]. Counts set bits, optionally restricted to a range.
BitPos
BITPOS key bit [range]. Finds first set or clear bit position.
BitOp
BITOP op destkey key [key …]. Bitwise operation across strings.
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
MemoryUsage
MEMORY USAGE. Returns the estimated memory footprint of a key in bytes.
Persist
Pttl
Pexpire
Expireat
EXPIREAT: set expiry at an absolute Unix timestamp (seconds).
Pexpireat
PEXPIREAT: set expiry at an absolute Unix timestamp (milliseconds).
LPush
RPush
LPop
RPop
LPopCount
LPOP key count — pop up to count elements from the list head, returning an array.
RPopCount
RPOP key count — pop up to count elements from the list tail, returning an array.
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
LmpopSingle
LMPOP single-key sub-request: pop up to count items from one list.
ZmpopSingle
ZMPOP single-key sub-request: pop up to count items from one sorted set.
HSet
HGet
HGetAll
HDel
HExists
HLen
HIncrBy
HIncrByFloat
HINCRBYFLOAT key field increment — increments a hash field by a float.
HKeys
HVals
HMGet
HRandField
HRANDFIELD — returns random field(s) from a hash; read-only, no AOF.
SAdd
SRem
SMembers
SIsMember
SCard
SUnion
SInter
SDiff
SUnionStore
SInterStore
SDiffStore
SRandMember
SPop
SMisMember
SMove
SMOVE — atomically moves a member between two sets on the same shard.
SInterCard
SINTERCARD — returns cardinality of set intersection, capped at limit (0 = no limit).
Expiretime
EXPIRETIME — returns the absolute expiry timestamp in seconds (-1 or -2 for missing/no-expiry).
Pexpiretime
PEXPIRETIME — returns the absolute expiry timestamp in milliseconds (-1 or -2 for missing/no-expiry).
LMove
LMOVE: atomically pops from source and pushes to destination.
GetDel
GETDEL: returns the value at key and deletes it.
GetSet
GETSET: atomically sets key to a new value and returns the old value.
MSetNx
MSETNX: sets multiple keys only if none already exist (atomic all-or-nothing).
GetEx
GETEX: returns the value at key and optionally updates its TTL.
expire: None = no change, Some(None) = persist, Some(Some(ms)) = new TTL in ms.
ZDiff
ZDIFF: returns members in the first sorted set not in the others.
ZInter
ZINTER: returns members present in all sorted sets, scores summed.
ZUnion
ZUNION: returns the union of all sorted sets, scores summed.
ZDiffStore
ZDIFFSTORE destkey numkeys key [key …] — stores diff result in dest.
ZInterStore
ZINTERSTORE destkey numkeys key [key …] — stores intersection in dest.
ZUnionStore
ZUNIONSTORE destkey numkeys key [key …] — stores union in dest.
ZRandMember
ZRANDMEMBER — returns random member(s) from a sorted set; read-only, no AOF.
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.
UpdateMemoryConfig
Applies a live memory configuration update to this shard.
Sent by the server when CONFIG SET maxmemory or maxmemory-policy is changed at runtime. Takes effect on the next write check.
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).