Interface ReactiveClusterCommands
- All Known Subinterfaces:
ReactiveRedisClusterConnection
public interface ReactiveClusterCommands
Interface for the cluster commands supported by Redis executed using reactive infrastructure. A
RedisClusterNode
can be obtained from clusterGetNodes()
or it can be constructed using either
host
and RedisNode.getPort()
or the node Id
.- Since:
- 2.3.2
- Author:
- Mark Paluch, Christoph Strobl
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>
clusterAddSlots
(RedisClusterNode node, int... slots) Assign slots to givenRedisClusterNode
.reactor.core.publisher.Mono<Void>
clusterAddSlots
(RedisClusterNode node, RedisClusterNode.SlotRange range) AssignRedisClusterNode.SlotRange.getSlotsArray()
to givenRedisClusterNode
.reactor.core.publisher.Mono<Long>
clusterCountKeysInSlot
(int slot) Count the number of keys assigned to one slot.reactor.core.publisher.Mono<Void>
clusterDeleteSlots
(RedisClusterNode node, int... slots) Remove slots fromRedisClusterNode
.reactor.core.publisher.Mono<Void>
RemovesRedisClusterNode.SlotRange.getSlotsArray()
from givenRedisClusterNode
.reactor.core.publisher.Mono<Void>
Remove given node from cluster.reactor.core.publisher.Mono<ClusterInfo>
Get cluster information.reactor.core.publisher.Flux<ByteBuffer>
clusterGetKeysInSlot
(int slot, int count) Get keys served by slot.reactor.core.publisher.Mono<Map<RedisClusterNode,
Collection<RedisClusterNode>>> Retrieve information about masters and their connected replicas.reactor.core.publisher.Mono<RedisClusterNode>
Find theRedisClusterNode
serving given key.reactor.core.publisher.Mono<RedisClusterNode>
clusterGetNodeForSlot
(int slot) Find theRedisClusterNode
serving given slot.reactor.core.publisher.Flux<RedisClusterNode>
Retrieve cluster node information such as id, host, port and slots.reactor.core.publisher.Flux<RedisClusterNode>
clusterGetReplicas
(RedisClusterNode master) Retrieve information about connected replicas for given master node.reactor.core.publisher.Mono<Integer>
Find the slot for a givenkey
.reactor.core.publisher.Mono<Void>
clusterMeet
(RedisClusterNode node) Add given node to cluster.reactor.core.publisher.Mono<Void>
clusterReplicate
(RedisClusterNode master, RedisClusterNode replica) Assign a replica to given master.reactor.core.publisher.Mono<Void>
clusterSetSlot
(RedisClusterNode node, int slot, ReactiveClusterCommands.AddSlots mode)
-
Method Details
-
clusterGetNodes
reactor.core.publisher.Flux<RedisClusterNode> clusterGetNodes()Retrieve cluster node information such as id, host, port and slots.- Returns:
- a
Flux
emittingcluster nodes
, anempty one
if none found. - See Also:
-
clusterGetReplicas
Retrieve information about connected replicas for given master node.- Parameters:
master
- must not be null.- Returns:
- a
Flux
emittingcluster nodes
, anempty one
if none found. - See Also:
-
clusterGetMasterReplicaMap
reactor.core.publisher.Mono<Map<RedisClusterNode,Collection<RedisClusterNode>>> clusterGetMasterReplicaMap()Retrieve information about masters and their connected replicas.- Returns:
- never null.
- See Also:
-
clusterGetSlotForKey
Find the slot for a givenkey
.- Parameters:
key
- must not be null.- Returns:
- a
Mono
emitting the calculated slog. - See Also:
-
clusterGetNodeForSlot
Find theRedisClusterNode
serving given slot.- Parameters:
slot
-- Returns:
- a
Mono
emitting theRedisClusterNode
handling the given slot.
-
clusterGetNodeForKey
Find theRedisClusterNode
serving given key.- Parameters:
key
- must not be null.- Returns:
- a
Mono
emitting theRedisClusterNode
handling the slot for the given key.
-
clusterGetClusterInfo
reactor.core.publisher.Mono<ClusterInfo> clusterGetClusterInfo()Get cluster information.- Returns:
- never null.
- See Also:
-
clusterAddSlots
Assign slots to givenRedisClusterNode
.- Parameters:
node
- must not be null.slots
- must not be empty.- Returns:
- a
Mono
signaling completion. - See Also:
-
clusterAddSlots
reactor.core.publisher.Mono<Void> clusterAddSlots(RedisClusterNode node, RedisClusterNode.SlotRange range) AssignRedisClusterNode.SlotRange.getSlotsArray()
to givenRedisClusterNode
.- Parameters:
node
- must not be null.range
- must not be null.- Returns:
- a
Mono
signaling completion. - See Also:
-
clusterCountKeysInSlot
Count the number of keys assigned to one slot.- Parameters:
slot
-- Returns:
- a
Mono
emitting the number of keys stored at the given slot. - See Also:
-
clusterDeleteSlots
Remove slots fromRedisClusterNode
.- Parameters:
node
- must not be null.- Returns:
- a
Mono
signaling completion. - See Also:
-
clusterDeleteSlotsInRange
reactor.core.publisher.Mono<Void> clusterDeleteSlotsInRange(RedisClusterNode node, RedisClusterNode.SlotRange range) RemovesRedisClusterNode.SlotRange.getSlotsArray()
from givenRedisClusterNode
.- Parameters:
node
- must not be null.range
- must not be null.- Returns:
- a
Mono
signaling completion. - See Also:
-
clusterForget
Remove given node from cluster.- Parameters:
node
- must not be null.- Returns:
- a
Mono
signaling completion. - See Also:
-
clusterMeet
Add given node to cluster.- Parameters:
node
- must containhost
andRedisNode.getPort()
and must not be null.- Returns:
- a
Mono
signaling completion. - See Also:
-
clusterSetSlot
reactor.core.publisher.Mono<Void> clusterSetSlot(RedisClusterNode node, int slot, ReactiveClusterCommands.AddSlots mode) - Parameters:
node
- must not be null.slot
-mode
- must not benull.- Returns:
- a
Mono
signaling completion. - See Also:
-
clusterGetKeysInSlot
Get keys served by slot.- Parameters:
slot
-count
- must not be null.- Returns:
- a
Flux
emitting the number of requested keys in the given slot, or signalling completion if none found. - See Also:
-
clusterReplicate
reactor.core.publisher.Mono<Void> clusterReplicate(RedisClusterNode master, RedisClusterNode replica) Assign a replica to given master.- Parameters:
master
- must not be null.replica
- must not be null.- Returns:
- a
Mono
signaling completion. - See Also:
-