redis

Enum Role

Source
pub enum Role {
    Primary {
        replication_offset: u64,
        replicas: Vec<ReplicaInfo>,
    },
    Replica {
        primary_ip: String,
        primary_port: u16,
        replication_state: String,
        data_received: u64,
    },
    Sentinel {
        primary_names: Vec<String>,
    },
}
Expand description

High level representation of response to the ROLE command.

Variants§

§

Primary

Represents a primary role, which is master in legacy Redis terminology.

Fields

§replication_offset: u64

The current primary replication offset

§replicas: Vec<ReplicaInfo>

List of replica, each represented by a tuple of IP, port and the last acknowledged replication offset.

§

Replica

Represents a replica role, which is slave in legacy Redis terminology.

Fields

§primary_ip: String

The IP of the primary.

§primary_port: u16

The port of the primary.

§replication_state: String

The state of the replication from the point of view of the primary.

§data_received: u64

The amount of data received from the replica so far in terms of primary replication offset.

§

Sentinel

Represents a sentinel role.

Fields

§primary_names: Vec<String>

List of primary names monitored by this Sentinel instance.

Trait Implementations§

Source§

impl Clone for Role

Source§

fn clone(&self) -> Role

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 Role

Source§

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

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

impl FromRedisValue for Role

Source§

fn from_redis_value(v: &Value) -> RedisResult<Self>

Given a redis Value this attempts to convert it into the given destination type. If that fails because it’s not compatible an appropriate error is generated.
Source§

fn from_owned_redis_value(v: Value) -> RedisResult<Self>

Given a redis Value this attempts to convert it into the given destination type. If that fails because it’s not compatible an appropriate error is generated.
Source§

fn from_redis_values(items: &[Value]) -> RedisResult<Vec<Self>>

Similar to from_redis_value but constructs a vector of objects from another vector of values. This primarily exists internally to customize the behavior for vectors of tuples.
Source§

fn from_owned_redis_values(items: Vec<Value>) -> RedisResult<Vec<Self>>

The same as from_redis_values, but takes a Vec<Value> instead of a &[Value].
Source§

fn from_byte_vec(_vec: &[u8]) -> Option<Vec<Self>>

Convert bytes to a single element vector.
Source§

fn from_owned_byte_vec(_vec: Vec<u8>) -> RedisResult<Vec<Self>>

Convert bytes to a single element vector.
Source§

impl PartialEq for Role

Source§

fn eq(&self, other: &Role) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Role

Source§

impl StructuralPartialEq for Role

Auto Trait Implementations§

§

impl Freeze for Role

§

impl RefUnwindSafe for Role

§

impl Send for Role

§

impl Sync for Role

§

impl Unpin for Role

§

impl UnwindSafe for Role

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T