Package org.apache.cassandra.locator
Class AbstractEndpointSnitch
- java.lang.Object
-
- org.apache.cassandra.locator.AbstractEndpointSnitch
-
- All Implemented Interfaces:
IEndpointSnitch
- Direct Known Subclasses:
AbstractNetworkTopologySnitch
,DynamicEndpointSnitch
,SimpleSnitch
public abstract class AbstractEndpointSnitch extends java.lang.Object implements IEndpointSnitch
-
-
Constructor Summary
Constructors Constructor Description AbstractEndpointSnitch()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract int
compareEndpoints(InetAddressAndPort target, Replica r1, Replica r2)
compares two endpoints in relation to the target endpoint, returning as Comparator.compare wouldvoid
gossiperStarting()
called after Gossiper instance exists immediately before it starts gossipingboolean
isWorthMergingForRangeQuery(ReplicaCollection<?> merged, ReplicaCollection<?> l1, ReplicaCollection<?> l2)
Returns whether for a range query doing a query against merged is likely to be faster than 2 sequential queries, one against l1 followed by one against l2.<C extends ReplicaCollection<? extends C>>
CsortedByProximity(InetAddressAndPort address, C unsortedAddress)
Sorts the Collection of node addresses by proximity to the given address-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.locator.IEndpointSnitch
getDatacenter, getDatacenter, getDatacenter, getLocalDatacenter, getLocalRack, getRack, validate
-
-
-
-
Method Detail
-
compareEndpoints
public abstract int compareEndpoints(InetAddressAndPort target, Replica r1, Replica r2)
Description copied from interface:IEndpointSnitch
compares two endpoints in relation to the target endpoint, returning as Comparator.compare would- Specified by:
compareEndpoints
in interfaceIEndpointSnitch
-
sortedByProximity
public <C extends ReplicaCollection<? extends C>> C sortedByProximity(InetAddressAndPort address, C unsortedAddress)
Sorts the Collection of node addresses by proximity to the given address- Specified by:
sortedByProximity
in interfaceIEndpointSnitch
- Parameters:
address
- the address to sort by proximity tounsortedAddress
- the nodes to sort- Returns:
- a new sorted List
-
gossiperStarting
public void gossiperStarting()
Description copied from interface:IEndpointSnitch
called after Gossiper instance exists immediately before it starts gossiping- Specified by:
gossiperStarting
in interfaceIEndpointSnitch
-
isWorthMergingForRangeQuery
public boolean isWorthMergingForRangeQuery(ReplicaCollection<?> merged, ReplicaCollection<?> l1, ReplicaCollection<?> l2)
Description copied from interface:IEndpointSnitch
Returns whether for a range query doing a query against merged is likely to be faster than 2 sequential queries, one against l1 followed by one against l2.- Specified by:
isWorthMergingForRangeQuery
in interfaceIEndpointSnitch
-
-