Class ClusterTopology
java.lang.Object
org.springframework.data.redis.connection.ClusterTopology
ClusterTopology
holds snapshot like information about RedisClusterNode
s.- Since:
- 1.7
- Author:
- Christoph Strobl, Mark Paluch
-
Constructor Summary
ConstructorDescriptionClusterTopology
(Set<RedisClusterNode> nodes) Creates new instance ofClusterTopology
. -
Method Summary
Modifier and TypeMethodDescriptionGet all master nodes in cluster wherelink-state
is connected andflags
does not contain fail or fail?.Get all nodes (master and replica) in cluster wherelink-state
is connected andflags
does not contain fail or fail?.getKeyServingMasterNode
(byte[] key) Get theRedisClusterNode
that is the current master serving the given key.getKeyServingNodes
(byte[] key) Get all master nodes in cluster.getNodes()
Get allRedisClusterNode
s.getSlotServingNodes
(int slot) Get theRedisClusterNode
s (master and replica) serving s specific slot.Get theRedisClusterNode
matching given nodeId.Get theRedisClusterNode
matching given host and port.lookup
(RedisClusterNode node)
-
Constructor Details
-
ClusterTopology
Creates new instance ofClusterTopology
.- Parameters:
nodes
- can be null.
-
-
Method Details
-
getNodes
Get allRedisClusterNode
s.- Returns:
- never null.
-
getActiveNodes
Get all nodes (master and replica) in cluster wherelink-state
is connected andflags
does not contain fail or fail?.- Returns:
- never null.
-
getActiveMasterNodes
Get all master nodes in cluster wherelink-state
is connected andflags
does not contain fail or fail?.- Returns:
- never null.
-
getMasterNodes
Get all master nodes in cluster.- Returns:
- never null.
-
getSlotServingNodes
Get theRedisClusterNode
s (master and replica) serving s specific slot.- Parameters:
slot
-- Returns:
- never null.
-
getKeyServingMasterNode
Get theRedisClusterNode
that is the current master serving the given key.- Parameters:
key
- must not be null.- Returns:
- never null.
- Throws:
ClusterStateFailureException
-
lookup
Get theRedisClusterNode
matching given host and port.- Parameters:
host
- must not be null.port
-- Returns:
- never null.
- Throws:
ClusterStateFailureException
-
lookup
Get theRedisClusterNode
matching given nodeId.- Parameters:
nodeId
- must not be null.- Returns:
- never null.
- Throws:
ClusterStateFailureException
-
lookup
- Parameters:
node
- must not be null- Returns:
- never null.
- Throws:
ClusterStateFailureException
-
getKeyServingNodes
- Parameters:
key
- must not be null.- Returns:
- null.
-