Skip to main content

ClusterCommands

Trait ClusterCommands 

Source
pub trait ClusterCommands<'a>: Sized {
Show 29 methods // Provided methods fn cluster_addslots( self, slots: impl Serialize, ) -> PreparedCommand<'a, Self, ()> { ... } fn cluster_addslotsrange( self, slots: impl Serialize, ) -> PreparedCommand<'a, Self, ()> { ... } fn cluster_bumpepoch( self, ) -> PreparedCommand<'a, Self, ClusterBumpEpochResult> { ... } fn cluster_count_failure_reports( self, node_id: impl Serialize, ) -> PreparedCommand<'a, Self, usize> { ... } fn cluster_countkeysinslot( self, slot: usize, ) -> PreparedCommand<'a, Self, usize> { ... } fn cluster_delslots( self, slots: impl Serialize, ) -> PreparedCommand<'a, Self, ()> { ... } fn cluster_delslotsrange( self, slots: impl Serialize, ) -> PreparedCommand<'a, Self, ()> { ... } fn cluster_failover( self, option: Option<ClusterFailoverOption>, ) -> PreparedCommand<'a, Self, ()> { ... } fn cluster_flushslots(self) -> PreparedCommand<'a, Self, ()> { ... } fn cluster_forget( self, node_id: impl Serialize, ) -> PreparedCommand<'a, Self, ()> { ... } fn cluster_getkeysinslot<R: DeserializeOwned>( self, slot: u16, count: usize, ) -> PreparedCommand<'a, Self, R> { ... } fn cluster_info(self) -> PreparedCommand<'a, Self, ClusterInfo> { ... } fn cluster_keyslot( self, key: impl Serialize, ) -> PreparedCommand<'a, Self, u16> { ... } fn cluster_links<R: DeserializeOwned>(self) -> PreparedCommand<'a, Self, R> { ... } fn cluster_meet( self, ip: impl Serialize, port: u16, cluster_bus_port: Option<u16>, ) -> PreparedCommand<'a, Self, ()> { ... } fn cluster_myid<R: DeserializeOwned>(self) -> PreparedCommand<'a, Self, R> { ... } fn cluster_myshardid<R: DeserializeOwned>( self, ) -> PreparedCommand<'a, Self, R> { ... } fn cluster_nodes<R: DeserializeOwned>(self) -> PreparedCommand<'a, Self, R> { ... } fn cluster_replicas<R: DeserializeOwned>( self, node_id: impl Serialize, ) -> PreparedCommand<'a, Self, R> { ... } fn cluster_replicate( self, node_id: impl Serialize, ) -> PreparedCommand<'a, Self, ()> { ... } fn cluster_reset( self, reset_type: ClusterResetType, ) -> PreparedCommand<'a, Self, ()> { ... } fn cluster_saveconfig(self) -> PreparedCommand<'a, Self, ()> { ... } fn cluster_set_config_epoch( self, config_epoch: u64, ) -> PreparedCommand<'a, Self, ()> { ... } fn cluster_setslot( self, slot: u16, subcommand: ClusterSetSlotSubCommand<'_>, ) -> PreparedCommand<'a, Self, ()> { ... } fn cluster_shards<R: DeserializeOwned>(self) -> PreparedCommand<'a, Self, R> { ... } fn cluster_slot_stats<R: DeserializeOwned>( self, filter: ClusterSlotStatsFilter, ) -> PreparedCommand<'a, Self, R> { ... } fn cluster_migration_import<R: DeserializeOwned>( self, slot_ranges: impl Serialize, ) -> PreparedCommand<'a, Self, R> { ... } fn cluster_migration_cancel( self, target: ClusterMigrationTarget<'_>, ) -> PreparedCommand<'a, Self, usize> { ... } fn cluster_migration_status<R: DeserializeOwned>( self, target: ClusterMigrationTarget<'_>, ) -> PreparedCommand<'a, Self, R> { ... }
}
Expand description

Provided Methods§

Source

fn cluster_addslots( self, slots: impl Serialize, ) -> PreparedCommand<'a, Self, ()>

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. If the command is successful, the node will map the specified hash slots to itself, and will start broadcasting the new configuration.

§See Also

https://redis.io/commands/cluster-addslots/

Source

fn cluster_addslotsrange( self, slots: impl Serialize, ) -> PreparedCommand<'a, Self, ()>

This command is similar to the cluster_addslots command in that they both assign hash slots to nodes.

The difference between the two commands is that cluster_addslots takes a list of slots to assign to the node, while this command takes a list of slot ranges (specified by a tuple containing start and end slots) to assign to the node.

§See Also

https://redis.io/commands/cluster-addslotsrange/

Source

fn cluster_bumpepoch(self) -> PreparedCommand<'a, Self, ClusterBumpEpochResult>

Advances the cluster config epoch.

§Return
  • Bumped if the epoch was incremented, or
  • Still if the node already has the greatest config epoch in the cluster.
§See Also

https://redis.io/commands/cluster-bumpepoch/

Source

fn cluster_count_failure_reports( self, node_id: impl Serialize, ) -> PreparedCommand<'a, Self, usize>

The command returns the number of failure reports for the specified node.

§Return

The number of active failure reports for the node.

§See Also

https://redis.io/commands/cluster-count-failure-reports/

Source

fn cluster_countkeysinslot( self, slot: usize, ) -> PreparedCommand<'a, Self, usize>

Returns the number of keys in the specified Redis Cluster hash slot.

§Return

The number of keys in the specified hash slot, or an error if the hash slot is invalid.

§See Also

https://redis.io/commands/cluster-countkeysinslot/

Source

fn cluster_delslots( self, slots: impl Serialize, ) -> PreparedCommand<'a, Self, ()>

In Redis Cluster, each node keeps track of which master is serving a particular hash slot. This command asks a particular Redis Cluster node to forget which master is serving the hash slots specified as arguments.

§See Also

https://redis.io/commands/cluster-delslots/

Source

fn cluster_delslotsrange( self, slots: impl Serialize, ) -> PreparedCommand<'a, Self, ()>

This command is similar to the cluster_delslotsrange command in that they both remove hash slots from the node.

The difference is that cluster_delslotsrange takes a list of hash slots to remove from the node, while this command takes a list of slot ranges (specified by a tuple containing start and end slots) to remove from the node.

§See Also

https://redis.io/commands/cluster-delslotsrange/

Source

fn cluster_failover( self, option: Option<ClusterFailoverOption>, ) -> PreparedCommand<'a, Self, ()>

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.

§Errors

An error cann occured if the operation cannot be executed, for example if we are talking with a node which is already a master.

§See Also

https://redis.io/commands/cluster-failover/

Source

fn cluster_flushslots(self) -> PreparedCommand<'a, Self, ()>

Deletes all slots from a node.

§See Also

https://redis.io/commands/cluster-flushslots/

Source

fn cluster_forget( self, node_id: impl Serialize, ) -> PreparedCommand<'a, Self, ()>

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.

§See Also

https://redis.io/commands/cluster-forget/

Source

fn cluster_getkeysinslot<R: DeserializeOwned>( self, slot: u16, count: usize, ) -> PreparedCommand<'a, Self, R>

The command returns an array of keys names stored in the contacted node and hashing to the specified hash slot.

The maximum number of keys to return is specified via the count argument, so that it is possible for the user of this API to batch-processing keys.

§Return

The names of the keys stored in the contacted node and hashing to slot.

§See Also

https://redis.io/commands/cluster-getkeysinslot/

Source

fn cluster_info(self) -> PreparedCommand<'a, Self, ClusterInfo>

This command provides info style information about Redis Cluster vital parameters.

§Return

The Cluster information

§See Also

https://redis.io/commands/cluster-info/

Source

fn cluster_keyslot(self, key: impl Serialize) -> PreparedCommand<'a, Self, u16>

Returns an integer identifying the hash slot the specified key hashes to.

§Return

The hash slot number.

§See Also

https://redis.io/commands/cluster-keyslot/

Each node in a Redis Cluster maintains a pair of long-lived TCP link with each peer in the cluster:

  • One for sending outbound messages towards the peer
  • and one for receiving inbound messages from the peer.

This command outputs information of all such peer links as an array, where each array element is a struct that contains attributes and their values for an individual link.

§Return

An array of structs where each struct contains various attributes and their values of a cluster link.

§See Also

https://redis.io/commands/cluster-links/

Source

fn cluster_meet( self, ip: impl Serialize, port: u16, cluster_bus_port: Option<u16>, ) -> PreparedCommand<'a, Self, ()>

This command is used in order to connect different Redis nodes with cluster support enabled, into a working cluster.

§Return

An array of structs where each struct contains various attributes and their values of a cluster link.

§See Also

https://redis.io/commands/cluster-meet/

Source

fn cluster_myid<R: DeserializeOwned>(self) -> PreparedCommand<'a, Self, R>

This command returns the unique, auto-generated identifier that is associated with the connected cluster node.

§Return

The node id.

§See Also

https://redis.io/commands/cluster-myid/

Source

fn cluster_myshardid<R: DeserializeOwned>(self) -> PreparedCommand<'a, Self, R>

Returns the shard id of the node the client is connected to.

A shard groups a master with its replicas, so every node of a shard reports the same shard id while keeping its own distinct node id (see cluster_myid).

§Return

The 40-character hexadecimal shard id.

§See Also

https://redis.io/commands/cluster-myshardid/

Source

fn cluster_nodes<R: DeserializeOwned>(self) -> PreparedCommand<'a, Self, R>

Each node in a Redis Cluster has its view of the current cluster configuration, given by the set of known nodes, the state of the connection we have with such nodes, their flags, properties and assigned slots, and so forth.

This command provides all this information, that is, the current cluster configuration of the node we are contacting, in a serialization format which happens to be exactly the same as the one used by Redis Cluster itself in order to store on disk the cluster state (however the on disk cluster state has a few additional info appended at the end).

§Return

The serialized cluster configuration. The output of the command is just a space-separated CSV string, where each line represents a node in the cluster.

§See Also

https://redis.io/commands/cluster-nodes/

Source

fn cluster_replicas<R: DeserializeOwned>( self, node_id: impl Serialize, ) -> PreparedCommand<'a, Self, R>

The command provides a list of replica nodes replicating from the specified master node.

§Return

The command returns data in the same format as cluster_nodes.

§See Also

https://redis.io/commands/cluster-replicas/

Source

fn cluster_replicate( self, node_id: impl Serialize, ) -> PreparedCommand<'a, Self, ()>

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.

§See Also

https://redis.io/commands/cluster-replicate/

Source

fn cluster_reset( self, reset_type: ClusterResetType, ) -> PreparedCommand<'a, Self, ()>

Reset a Redis Cluster node, in a more or less drastic way depending on the reset type, that can be hard or soft.

§See Also

https://redis.io/commands/cluster-reset/

Source

fn cluster_saveconfig(self) -> PreparedCommand<'a, Self, ()>

Forces a node to save the nodes.conf configuration on disk. Before to return the command calls fsync(2) in order to make sure the configuration is flushed on the computer disk.

§See Also

https://redis.io/commands/cluster-saveconfig/

Source

fn cluster_set_config_epoch( self, config_epoch: u64, ) -> PreparedCommand<'a, Self, ()>

This command sets a specific config epoch in a fresh node.

§See Also

https://redis.io/commands/cluster-set-config-epoch/

Source

fn cluster_setslot( self, slot: u16, subcommand: ClusterSetSlotSubCommand<'_>, ) -> PreparedCommand<'a, Self, ()>

This command is responsible of changing the state of a hash slot in the receiving node in different ways.

§See Also

https://redis.io/commands/cluster-setslot/

Source

fn cluster_shards<R: DeserializeOwned>(self) -> PreparedCommand<'a, Self, R>

This command returns details about the shards of the cluster.

§Return

A list of shard information for each shard (slot ranges & shard nodes)

§See Also

https://redis.io/commands/cluster-shards/

Source

fn cluster_slot_stats<R: DeserializeOwned>( self, filter: ClusterSlotStatsFilter, ) -> PreparedCommand<'a, Self, R>

Returns per-slot usage statistics for the slots assigned to the current node.

Select the slots with a ClusterSlotStatsFilter: an inclusive slot range (always sorted by slot number), or an ORDERBY a metric with an optional LIMIT and sort order. All metrics except KEY-COUNT require cluster-slot-stats-enabled yes in the server configuration.

§Return

A nested list of per-slot statistics.

§See Also

https://redis.io/commands/cluster-slot-stats/

Source

fn cluster_migration_import<R: DeserializeOwned>( self, slot_ranges: impl Serialize, ) -> PreparedCommand<'a, Self, R>

Starts an atomic migration importing the given inclusive slot ranges onto the current (destination) master.

slot_ranges is a flat sequence of start end pairs, e.g. [(0, 1000), (2000, 3000)].

§Return

the task id, which can be passed to cluster_migration_status or cluster_migration_cancel.

§See Also

https://redis.io/commands/cluster-migration/

Source

fn cluster_migration_cancel( self, target: ClusterMigrationTarget<'_>, ) -> PreparedCommand<'a, Self, usize>

Cancels an ongoing atomic migration task by id, or all of them.

§Return

the number of cancelled tasks.

§See Also

https://redis.io/commands/cluster-migration/

Source

fn cluster_migration_status<R: DeserializeOwned>( self, target: ClusterMigrationTarget<'_>, ) -> PreparedCommand<'a, Self, R>

Returns the status of atomic migration tasks: a single task for a ClusterMigrationTarget::Id, or all tasks for ClusterMigrationTarget::All.

§Return

A list of migration task details (field/value pairs per task).

§See Also

https://redis.io/commands/cluster-migration/

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a> ClusterCommands<'a> for &'a Client

Source§

impl<'a> ClusterCommands<'a> for &'a ExclusiveClient

Source§

impl<'a> ClusterCommands<'a> for &'a mut Pipeline<'_>