Skip to main content

ShardRequest

Enum ShardRequest 

Source
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

Fields

§

Set

Fields

§value: Bytes
§nx: bool

Only set the key if it does not already exist.

§xx: bool

Only set the key if it already exists.

§

Incr

Fields

§

Decr

Fields

§

IncrBy

Fields

§delta: i64
§

DecrBy

Fields

§delta: i64
§

IncrByFloat

Fields

§delta: f64
§

Append

Fields

§value: Bytes
§

Strlen

Fields

§

GetRange

Fields

§start: i64
§end: i64
§

SetRange

Fields

§offset: usize
§value: Bytes
§

GetBit

GETBIT key offset. Returns the bit at offset (0 or 1). Big-endian ordering.

Fields

§offset: u64
§

SetBit

SETBIT key offset value. Sets the bit at offset to 0 or 1. Returns old bit.

Fields

§offset: u64
§value: u8
§

BitCount

BITCOUNT key [range]. Counts set bits, optionally restricted to a range.

Fields

§

BitPos

BITPOS key bit [range]. Finds first set or clear bit position.

Fields

§bit: u8
§

BitOp

BITOP op destkey key [key …]. Bitwise operation across strings.

Fields

§dest: String
§keys: Vec<String>
§

Keys

Returns all keys matching a glob pattern in this shard.

Fields

§pattern: String
§

Rename

Renames a key within this shard.

Fields

§newkey: String
§

Copy

Copies the value at source to destination within this shard.

Fields

§source: String
§destination: String
§replace: bool
§

ObjectEncoding

Returns the internal encoding name for the value at key.

Fields

§

Del

Fields

Like DEL but defers value deallocation to the background drop thread.

Fields

§

Exists

Fields

§

RandomKey

Returns a random key from the shard’s keyspace.

§

Touch

Updates last access time for a key. Returns bool (existed).

Fields

§

Sort

Sorts elements from a list, set, or sorted set in this shard.

Fields

§desc: bool
§alpha: bool
§limit: Option<(i64, i64)>
§

Expire

Fields

§seconds: u64
§

Ttl

Fields

§

MemoryUsage

MEMORY USAGE. Returns the estimated memory footprint of a key in bytes.

Fields

§

Persist

Fields

§

Pttl

Fields

§

Pexpire

Fields

§milliseconds: u64
§

Expireat

EXPIREAT: set expiry at an absolute Unix timestamp (seconds).

Fields

§timestamp: u64
§

Pexpireat

PEXPIREAT: set expiry at an absolute Unix timestamp (milliseconds).

Fields

§timestamp_ms: u64
§

LPush

Fields

§values: Vec<Bytes>
§

RPush

Fields

§values: Vec<Bytes>
§

LPop

Fields

§

RPop

Fields

§

LPopCount

LPOP key count — pop up to count elements from the list head, returning an array.

Fields

§count: usize
§

RPopCount

RPOP key count — pop up to count elements from the list tail, returning an array.

Fields

§count: usize
§

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.

Fields

§waiter: Sender<(String, Bytes)>
§

BRPop

Blocking right-pop. Same semantics as BLPop but pops from the tail.

Fields

§waiter: Sender<(String, Bytes)>
§

LRange

Fields

§start: i64
§stop: i64
§

LLen

Fields

§

LIndex

Fields

§index: i64
§

LSet

Fields

§index: i64
§value: Bytes
§

LTrim

Fields

§start: i64
§stop: i64
§

LInsert

Fields

§before: bool
§pivot: Bytes
§value: Bytes
§

LRem

Fields

§count: i64
§value: Bytes
§

LPos

Fields

§element: Bytes
§rank: i64
§count: usize
§maxlen: usize
§

Type

Fields

§

ZAdd

Fields

§members: Vec<(f64, String)>
§nx: bool
§xx: bool
§gt: bool
§lt: bool
§ch: bool
§

ZRem

Fields

§members: Vec<String>
§

ZScore

Fields

§member: String
§

ZRank

Fields

§member: String
§

ZRevRank

Fields

§member: String
§

ZCard

Fields

§

ZRange

Fields

§start: i64
§stop: i64
§with_scores: bool
§

ZRevRange

Fields

§start: i64
§stop: i64
§with_scores: bool
§

ZCount

§

ZIncrBy

Fields

§increment: f64
§member: String
§

ZRangeByScore

Fields

§offset: usize
§count: Option<usize>
§

ZRevRangeByScore

Fields

§offset: usize
§count: Option<usize>
§

ZPopMin

Fields

§count: usize
§

ZPopMax

Fields

§count: usize
§

LmpopSingle

LMPOP single-key sub-request: pop up to count items from one list.

Fields

§left: bool
§count: usize
§

ZmpopSingle

ZMPOP single-key sub-request: pop up to count items from one sorted set.

Fields

§min: bool
§count: usize
§

HSet

Fields

§fields: Vec<(String, Bytes)>
§

HGet

Fields

§field: String
§

HGetAll

Fields

§

HDel

Fields

§fields: Vec<String>
§

HExists

Fields

§field: String
§

HLen

Fields

§

HIncrBy

Fields

§field: String
§delta: i64
§

HIncrByFloat

HINCRBYFLOAT key field increment — increments a hash field by a float.

Fields

§field: String
§delta: f64
§

HKeys

Fields

§

HVals

Fields

§

HMGet

Fields

§fields: Vec<String>
§

HRandField

HRANDFIELD — returns random field(s) from a hash; read-only, no AOF.

Fields

§count: Option<i64>
§with_values: bool
§

SAdd

Fields

§members: Vec<String>
§

SRem

Fields

§members: Vec<String>
§

SMembers

Fields

§

SIsMember

Fields

§member: String
§

SCard

Fields

§

SUnion

Fields

§keys: Vec<String>
§

SInter

Fields

§keys: Vec<String>
§

SDiff

Fields

§keys: Vec<String>
§

SUnionStore

Fields

§dest: String
§keys: Vec<String>
§

SInterStore

Fields

§dest: String
§keys: Vec<String>
§

SDiffStore

Fields

§dest: String
§keys: Vec<String>
§

SRandMember

Fields

§count: i64
§

SPop

Fields

§count: usize
§

SMisMember

Fields

§members: Vec<String>
§

SMove

SMOVE — atomically moves a member between two sets on the same shard.

Fields

§source: String
§destination: String
§member: String
§

SInterCard

SINTERCARD — returns cardinality of set intersection, capped at limit (0 = no limit).

Fields

§keys: Vec<String>
§limit: usize
§

Expiretime

EXPIRETIME — returns the absolute expiry timestamp in seconds (-1 or -2 for missing/no-expiry).

Fields

§

Pexpiretime

PEXPIRETIME — returns the absolute expiry timestamp in milliseconds (-1 or -2 for missing/no-expiry).

Fields

§

LMove

LMOVE: atomically pops from source and pushes to destination.

Fields

§source: String
§destination: String
§src_left: bool
§dst_left: bool
§

GetDel

GETDEL: returns the value at key and deletes it.

Fields

§

GetSet

GETSET: atomically sets key to a new value and returns the old value.

Fields

§value: Bytes
§

MSetNx

MSETNX: sets multiple keys only if none already exist (atomic all-or-nothing).

Fields

§pairs: Vec<(String, Bytes)>
§

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.

Fields

§expire: Option<Option<u64>>
§

ZDiff

ZDIFF: returns members in the first sorted set not in the others.

Fields

§keys: Vec<String>
§

ZInter

ZINTER: returns members present in all sorted sets, scores summed.

Fields

§keys: Vec<String>
§

ZUnion

ZUNION: returns the union of all sorted sets, scores summed.

Fields

§keys: Vec<String>
§

ZDiffStore

ZDIFFSTORE destkey numkeys key [key …] — stores diff result in dest.

Fields

§dest: String
§keys: Vec<String>
§

ZInterStore

ZINTERSTORE destkey numkeys key [key …] — stores intersection in dest.

Fields

§dest: String
§keys: Vec<String>
§

ZUnionStore

ZUNIONSTORE destkey numkeys key [key …] — stores union in dest.

Fields

§dest: String
§keys: Vec<String>
§

ZRandMember

ZRANDMEMBER — returns random member(s) from a sorted set; read-only, no AOF.

Fields

§count: Option<i64>
§with_scores: bool
§

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.

Fields

§

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.

Fields

§max_memory: Option<usize>
§eviction_policy: EvictionPolicy
§

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.

Fields

§cursor: u64
§count: usize
§pattern: Option<String>
§

SScan

Incrementally iterates set members.

Fields

§cursor: u64
§count: usize
§pattern: Option<String>
§

HScan

Incrementally iterates hash fields.

Fields

§cursor: u64
§count: usize
§pattern: Option<String>
§

ZScan

Incrementally iterates sorted set members.

Fields

§cursor: u64
§count: usize
§pattern: Option<String>
§

CountKeysInSlot

Counts keys in this shard that hash to the given cluster slot.

Fields

§slot: u16
§

GetKeysInSlot

Returns up to count keys that hash to the given cluster slot.

Fields

§slot: u16
§count: usize
§

DumpKey

Dumps a key’s value as serialized bytes for MIGRATE.

Fields

§

RestoreKey

Restores a key from serialized bytes (received via MIGRATE).

Fields

§ttl_ms: u64
§data: Bytes
§replace: bool

Trait Implementations§

Source§

impl Debug for ShardRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> OptionalSend for T
where T: Send + ?Sized,

Source§

impl<T> OptionalSync for T
where T: Sync + ?Sized,