Enum ResponsePolicy

Source
pub enum ResponsePolicy {
    OneSucceeded,
    AllSucceeded,
    AggLogicalAnd,
    AggLogicalOr,
    AggMin,
    AggMax,
    AggSum,
    Special,
}
Expand description

This tip can help clients determine the aggregate they need to compute from the replies of multiple shards in a cluster.

The default behavior for commands without a request_policy tip only applies to replies with of nested types (i.e., an array, a set, or a map). The client’s implementation for the default behavior should be as follows:

  1. The command doesn’t accept key name arguments: the client can aggregate all replies within a single nested data structure. For example, the array replies we get from calling keys against all shards. These should be packed in a single in no particular order.
  2. For commands that accept one or more key name arguments: the client needs to retain the same order of replies as the input key names. For example, mget’s aggregated reply.

Variants§

§

OneSucceeded

the clients should return success if at least one shard didn’t reply with an error.

The client should reply with the first non-error reply it obtains. If all shards return an error, the client can reply with any one of these. For example, consider a script_kill command that’s sent to all shards. Although the script should be loaded in all of the cluster’s shards, the script_kill will typically run only on one at a given time.

§

AllSucceeded

the client should return successfully only if there are no error replies.

Even a single error reply should disqualify the aggregate and be returned. Otherwise, the client should return one of the non-error replies. As an example, consider the config_set, script_flush and script_load commands.

§

AggLogicalAnd

the client should return the result of a logical AND operation on all replies (only applies to integer replies, usually from commands that return either 0 or 1).

Consider the script_exists command as an example. It returns an array of 0’s and 1’s that denote the existence of its given SHA1 sums in the script cache. The aggregated response should be 1 only when all shards had reported that a given script SHA1 sum is in their respective cache.

§

AggLogicalOr

the client should return the result of a logical OR operation on all replies (only applies to integer replies, usually from commands that return either 0 or 1).

§

AggMin

the client should return the minimal value from the replies (only applies to numerical replies).

The aggregate reply from a cluster-wide wait command, for example, should be the minimal value (number of synchronized replicas) from all shards

§

AggMax

the client should return the maximal value from the replies (only applies to numerical replies).

§

AggSum

the client should return the sum of replies (only applies to numerical replies).

Example: dbsize.

§

Special

this type of tip indicates a non-trivial form of reply policy.

info is an excellent example of that.

Trait Implementations§

Source§

impl Clone for ResponsePolicy

Source§

fn clone(&self) -> ResponsePolicy

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ResponsePolicy

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ResponsePolicy

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl FromStr for ResponsePolicy

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(str: &str) -> Result<Self>

Parses a string s to return a value of this type. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Response for T