Trait fred::interfaces::ClusterInterface
source · pub trait ClusterInterface: ClientLike + Sized {
Show 24 methods
// Provided methods
fn cached_cluster_state(&self) -> Option<ClusterRouting> { ... }
fn num_primary_cluster_nodes(&self) -> usize { ... }
fn sync_cluster(&self) -> impl Future<Output = Result<(), RedisError>> { ... }
fn cluster_bumpepoch<R>(&self) -> impl Future<Output = RedisResult<R>>
where R: FromRedis { ... }
fn cluster_flushslots(&self) -> impl Future<Output = RedisResult<()>> { ... }
fn cluster_myid<R>(&self) -> impl Future<Output = RedisResult<R>>
where R: FromRedis { ... }
fn cluster_nodes<R>(&self) -> impl Future<Output = RedisResult<R>>
where R: FromRedis { ... }
fn cluster_saveconfig(&self) -> impl Future<Output = RedisResult<()>> { ... }
fn cluster_slots<R>(&self) -> impl Future<Output = RedisResult<R>>
where R: FromRedis { ... }
fn cluster_info<R>(&self) -> impl Future<Output = RedisResult<R>>
where R: FromRedis { ... }
fn cluster_add_slots<S>(
&self,
slots: S,
) -> impl Future<Output = RedisResult<()>>
where S: Into<MultipleHashSlots> { ... }
fn cluster_count_failure_reports<R, S>(
&self,
node_id: S,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
S: Into<Str> { ... }
fn cluster_count_keys_in_slot<R>(
&self,
slot: u16,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis { ... }
fn cluster_del_slots<S>(
&self,
slots: S,
) -> impl Future<Output = RedisResult<()>>
where S: Into<MultipleHashSlots> { ... }
fn cluster_failover(
&self,
flag: Option<ClusterFailoverFlag>,
) -> impl Future<Output = RedisResult<()>> { ... }
fn cluster_forget<S>(
&self,
node_id: S,
) -> impl Future<Output = RedisResult<()>>
where S: Into<Str> { ... }
fn cluster_get_keys_in_slot<R>(
&self,
slot: u16,
count: u64,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis { ... }
fn cluster_keyslot<R, K>(
&self,
key: K,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn cluster_meet<S>(
&self,
ip: S,
port: u16,
) -> impl Future<Output = RedisResult<()>>
where S: Into<Str> { ... }
fn cluster_replicate<S>(
&self,
node_id: S,
) -> impl Future<Output = RedisResult<()>>
where S: Into<Str> { ... }
fn cluster_replicas<R, S>(
&self,
node_id: S,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
S: Into<Str> { ... }
fn cluster_reset(
&self,
mode: Option<ClusterResetFlag>,
) -> impl Future<Output = RedisResult<()>> { ... }
fn cluster_set_config_epoch(
&self,
epoch: u64,
) -> impl Future<Output = RedisResult<()>> { ... }
fn cluster_setslot(
&self,
slot: u16,
state: ClusterSetSlotState,
) -> impl Future<Output = RedisResult<()>> { ... }
}i-cluster only.Expand description
Functions that implement the cluster interface.
Provided Methods§
sourcefn cached_cluster_state(&self) -> Option<ClusterRouting>
fn cached_cluster_state(&self) -> Option<ClusterRouting>
Read the cached cluster state used for routing commands to the correct cluster nodes.
sourcefn num_primary_cluster_nodes(&self) -> usize
fn num_primary_cluster_nodes(&self) -> usize
Read the number of known primary cluster nodes, or 0 if the cluster state is not known.
sourcefn sync_cluster(&self) -> impl Future<Output = Result<(), RedisError>>
fn sync_cluster(&self) -> impl Future<Output = Result<(), RedisError>>
Update the cached cluster state and add or remove any changed cluster node connections.
sourcefn cluster_bumpepoch<R>(&self) -> impl Future<Output = RedisResult<R>>where
R: FromRedis,
fn cluster_bumpepoch<R>(&self) -> impl Future<Output = RedisResult<R>>where
R: FromRedis,
Advances the cluster config epoch.
sourcefn cluster_flushslots(&self) -> impl Future<Output = RedisResult<()>>
fn cluster_flushslots(&self) -> impl Future<Output = RedisResult<()>>
Deletes all slots from a node.
sourcefn cluster_myid<R>(&self) -> impl Future<Output = RedisResult<R>>where
R: FromRedis,
fn cluster_myid<R>(&self) -> impl Future<Output = RedisResult<R>>where
R: FromRedis,
Returns the node’s id.
sourcefn cluster_nodes<R>(&self) -> impl Future<Output = RedisResult<R>>where
R: FromRedis,
fn cluster_nodes<R>(&self) -> impl Future<Output = RedisResult<R>>where
R: FromRedis,
Read the current cluster node configuration.
Note: The client keeps a cached, parsed version of the cluster state in memory available at cached_cluster_state.
sourcefn cluster_saveconfig(&self) -> impl Future<Output = RedisResult<()>>
fn cluster_saveconfig(&self) -> impl Future<Output = RedisResult<()>>
Forces a node to save the nodes.conf configuration on disk.
sourcefn cluster_slots<R>(&self) -> impl Future<Output = RedisResult<R>>where
R: FromRedis,
fn cluster_slots<R>(&self) -> impl Future<Output = RedisResult<R>>where
R: FromRedis,
CLUSTER SLOTS returns details about which cluster slots map to which Redis instances.
sourcefn cluster_info<R>(&self) -> impl Future<Output = RedisResult<R>>where
R: FromRedis,
fn cluster_info<R>(&self) -> impl Future<Output = RedisResult<R>>where
R: FromRedis,
CLUSTER INFO provides INFO style information about Redis Cluster vital parameters.
sourcefn cluster_add_slots<S>(
&self,
slots: S,
) -> impl Future<Output = RedisResult<()>>where
S: Into<MultipleHashSlots>,
fn cluster_add_slots<S>(
&self,
slots: S,
) -> impl Future<Output = RedisResult<()>>where
S: Into<MultipleHashSlots>,
This command is useful in order to modify a node’s view of the cluster configuration. Specifically it assigns a set of hash slots to the node receiving the command.
sourcefn cluster_count_failure_reports<R, S>(
&self,
node_id: S,
) -> impl Future<Output = RedisResult<R>>
fn cluster_count_failure_reports<R, S>( &self, node_id: S, ) -> impl Future<Output = RedisResult<R>>
The command returns the number of failure reports for the specified node.
sourcefn cluster_count_keys_in_slot<R>(
&self,
slot: u16,
) -> impl Future<Output = RedisResult<R>>where
R: FromRedis,
fn cluster_count_keys_in_slot<R>(
&self,
slot: u16,
) -> impl Future<Output = RedisResult<R>>where
R: FromRedis,
Returns the number of keys in the specified Redis Cluster hash slot.
sourcefn cluster_del_slots<S>(
&self,
slots: S,
) -> impl Future<Output = RedisResult<()>>where
S: Into<MultipleHashSlots>,
fn cluster_del_slots<S>(
&self,
slots: S,
) -> impl Future<Output = RedisResult<()>>where
S: Into<MultipleHashSlots>,
The CLUSTER DELSLOTS command asks a particular Redis Cluster node to forget which master is serving the hash slots specified as arguments.
sourcefn cluster_failover(
&self,
flag: Option<ClusterFailoverFlag>,
) -> impl Future<Output = RedisResult<()>>
fn cluster_failover( &self, flag: Option<ClusterFailoverFlag>, ) -> impl Future<Output = RedisResult<()>>
This command, that can only be sent to a Redis Cluster replica node, forces the replica to start a manual failover of its master instance.
sourcefn cluster_forget<S>(&self, node_id: S) -> impl Future<Output = RedisResult<()>>where
S: Into<Str>,
fn cluster_forget<S>(&self, node_id: S) -> impl Future<Output = RedisResult<()>>where
S: Into<Str>,
The command is used in order to remove a node, specified via its node ID, from the set of known nodes of the Redis Cluster node receiving the command. In other words the specified node is removed from the nodes table of the node receiving the command.
sourcefn cluster_get_keys_in_slot<R>(
&self,
slot: u16,
count: u64,
) -> impl Future<Output = RedisResult<R>>where
R: FromRedis,
fn cluster_get_keys_in_slot<R>(
&self,
slot: u16,
count: u64,
) -> impl Future<Output = RedisResult<R>>where
R: FromRedis,
The command returns an array of keys names stored in the contacted node and hashing to the specified hash slot.
sourcefn cluster_keyslot<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
fn cluster_keyslot<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
Returns an integer identifying the hash slot the specified key hashes to.
sourcefn cluster_meet<S>(
&self,
ip: S,
port: u16,
) -> impl Future<Output = RedisResult<()>>where
S: Into<Str>,
fn cluster_meet<S>(
&self,
ip: S,
port: u16,
) -> impl Future<Output = RedisResult<()>>where
S: Into<Str>,
CLUSTER MEET is used in order to connect different Redis nodes with cluster support enabled, into a working cluster.
sourcefn cluster_replicate<S>(
&self,
node_id: S,
) -> impl Future<Output = RedisResult<()>>where
S: Into<Str>,
fn cluster_replicate<S>(
&self,
node_id: S,
) -> impl Future<Output = RedisResult<()>>where
S: Into<Str>,
The command reconfigures a node as a replica of the specified master. If the node receiving the command is an empty master, as a side effect of the command, the node role is changed from master to replica.
sourcefn cluster_replicas<R, S>(
&self,
node_id: S,
) -> impl Future<Output = RedisResult<R>>
fn cluster_replicas<R, S>( &self, node_id: S, ) -> impl Future<Output = RedisResult<R>>
The command provides a list of replica nodes replicating from the specified master node.
sourcefn cluster_reset(
&self,
mode: Option<ClusterResetFlag>,
) -> impl Future<Output = RedisResult<()>>
fn cluster_reset( &self, mode: Option<ClusterResetFlag>, ) -> impl Future<Output = RedisResult<()>>
Reset a Redis Cluster node, in a more or less drastic way depending on the reset type, that can be hard or soft. Note that this command does not work for masters if they hold one or more keys, in that case to completely reset a master node keys must be removed first, e.g. by using FLUSHALL first, and then CLUSTER RESET.
sourcefn cluster_set_config_epoch(
&self,
epoch: u64,
) -> impl Future<Output = RedisResult<()>>
fn cluster_set_config_epoch( &self, epoch: u64, ) -> impl Future<Output = RedisResult<()>>
This command sets a specific config epoch in a fresh node.
sourcefn cluster_setslot(
&self,
slot: u16,
state: ClusterSetSlotState,
) -> impl Future<Output = RedisResult<()>>
fn cluster_setslot( &self, slot: u16, state: ClusterSetSlotState, ) -> impl Future<Output = RedisResult<()>>
CLUSTER SETSLOT is responsible for changing the state of a hash slot in the receiving node in different ways.