java.lang.Object
io.lettuce.core.cluster.topology.TopologyComparators
public class TopologyComparators extends Object
Comparators for
RedisClusterNode and RedisURI.- Author:
- Mark Paluch, Alessandro Simi
-
Constructor Summary
Constructors Constructor Description TopologyComparators() -
Method Summary
Modifier and Type Method Description static booleanisChanged(Partitions o1, Partitions o2)Check if properties changed which are essential for cluster operations.static List<RedisClusterNode>predefinedSort(Iterable<RedisClusterNode> clusterNodes, Iterable<RedisURI> fixedOrder)Sort partitions by afixedOrderand byRedisURI.static List<RedisClusterNode>sortByClientCount(Iterable<RedisClusterNode> clusterNodes)Sort partitions by client count.static List<RedisClusterNode>sortByLatency(Iterable<RedisClusterNode> clusterNodes)Sort partitions by latency.static List<RedisClusterNode>sortByUri(Iterable<RedisClusterNode> clusterNodes)Sort partitions by RedisURI.
-
Constructor Details
-
TopologyComparators
public TopologyComparators()
-
-
Method Details
-
predefinedSort
public static List<RedisClusterNode> predefinedSort(Iterable<RedisClusterNode> clusterNodes, Iterable<RedisURI> fixedOrder)Sort partitions by afixedOrderand byRedisURI. Nodes are sorted as provided infixedOrder.RedisURIss not contained infixedOrderare ordered after the fixed sorting and sorted wihin the block by comparingRedisURI.- Parameters:
clusterNodes- the sorting inputfixedOrder- the fixed order part- Returns:
- List containing
RedisClusterNodes ordered byfixedOrderandRedisURI - See Also:
sortByUri(Iterable)
-
sortByUri
Sort partitions by RedisURI.- Parameters:
clusterNodes-- Returns:
- List containing
RedisClusterNodes ordered byRedisURI
-
sortByClientCount
Sort partitions by client count.- Parameters:
clusterNodes-- Returns:
- List containing
RedisClusterNodes ordered by client count
-
sortByLatency
Sort partitions by latency.- Parameters:
clusterNodes-- Returns:
- List containing
RedisClusterNodes ordered by latency
-
isChanged
Check if properties changed which are essential for cluster operations.- Parameters:
o1- the first object to be compared.o2- the second object to be compared.- Returns:
trueifUPSTREAMorREPLICAflags changed or the responsible slots changed.
-