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