Struct fred::types::ClusterRouting
source · pub struct ClusterRouting { /* private fields */ }Expand description
The cached view of the cluster used by the client to route commands to the correct cluster nodes.
Implementations§
source§impl ClusterRouting
impl ClusterRouting
sourcepub fn from_cluster_slots<S: Into<Str>>(
value: RedisValue,
default_host: S,
) -> Result<Self, RedisError>
pub fn from_cluster_slots<S: Into<Str>>( value: RedisValue, default_host: S, ) -> Result<Self, RedisError>
Create a new routing table from the result of the CLUSTER SLOTS command.
The default_host value refers to the server that provided the response.
sourcepub fn unique_hash_slots(&self) -> Vec<u16>
pub fn unique_hash_slots(&self) -> Vec<u16>
Read a set of unique hash slots that each map to a different primary/main node in the cluster.
sourcepub fn unique_primary_nodes(&self) -> Vec<Server>
pub fn unique_primary_nodes(&self) -> Vec<Server>
Read the set of unique primary nodes in the cluster.
sourcepub fn get_server(&self, slot: u16) -> Option<&Server>
pub fn get_server(&self, slot: u16) -> Option<&Server>
Find the primary server that owns the provided hash slot.
sourcepub fn replicas(&self, primary: &Server) -> Vec<Server>
Available on crate feature replicas only.
pub fn replicas(&self, primary: &Server) -> Vec<Server>
replicas only.Read the replicas associated with the provided primary node based on the cached CLUSTER SLOTS response.
sourcepub fn random_slot(&self) -> Option<&SlotRange>
pub fn random_slot(&self) -> Option<&SlotRange>
Read a random primary node hash slot range from the cluster cache.
sourcepub fn random_node(&self) -> Option<&Server>
pub fn random_node(&self) -> Option<&Server>
Read a random primary node from the cluster cache.
Trait Implementations§
source§impl Clone for ClusterRouting
impl Clone for ClusterRouting
source§fn clone(&self) -> ClusterRouting
fn clone(&self) -> ClusterRouting
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ClusterRouting
impl RefUnwindSafe for ClusterRouting
impl Send for ClusterRouting
impl Sync for ClusterRouting
impl Unpin for ClusterRouting
impl UnwindSafe for ClusterRouting
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more