Package org.apache.cassandra.locator
Interface IEndpointSnitch
-
- All Known Implementing Classes:
AbstractEndpointSnitch
,AbstractNetworkTopologySnitch
,AlibabaCloudSnitch
,AzureSnitch
,CloudstackSnitch
,DynamicEndpointSnitch
,Ec2MultiRegionSnitch
,Ec2Snitch
,GoogleCloudSnitch
,GossipingPropertyFileSnitch
,PropertyFileSnitch
,RackInferringSnitch
,SimpleSnitch
public interface IEndpointSnitch
This interface helps determine location of node in the datacenter relative to another node. Give a node A and another node B it can tell if A and B are on the same rack or in the same datacenter.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description int
compareEndpoints(InetAddressAndPort target, Replica r1, Replica r2)
compares two endpoints in relation to the target endpoint, returning as Comparator.compare woulddefault java.lang.String
getDatacenter(java.net.InetSocketAddress endpoint)
java.lang.String
getDatacenter(InetAddressAndPort endpoint)
returns a String representing the datacenter the given endpoint belongs todefault java.lang.String
getDatacenter(Replica replica)
default java.lang.String
getLocalDatacenter()
returns a String representing the datacenter current endpoint belongs todefault java.lang.String
getLocalRack()
returns a String representing the rack current endpoint belongs tojava.lang.String
getRack(InetAddressAndPort endpoint)
returns a String representing the rack the given endpoint belongs tovoid
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 addresses)
returns a new List sorted by proximity to the given endpointdefault boolean
validate(java.util.Set<java.lang.String> datacenters, java.util.Set<java.lang.String> racks)
Determine if the datacenter or rack values in the current node's snitch conflict with those passed in parameters.
-
-
-
Method Detail
-
getRack
java.lang.String getRack(InetAddressAndPort endpoint)
returns a String representing the rack the given endpoint belongs to
-
getLocalRack
default java.lang.String getLocalRack()
returns a String representing the rack current endpoint belongs to
-
getDatacenter
java.lang.String getDatacenter(InetAddressAndPort endpoint)
returns a String representing the datacenter the given endpoint belongs to
-
getLocalDatacenter
default java.lang.String getLocalDatacenter()
returns a String representing the datacenter current endpoint belongs to
-
getDatacenter
default java.lang.String getDatacenter(java.net.InetSocketAddress endpoint)
-
getDatacenter
default java.lang.String getDatacenter(Replica replica)
-
sortedByProximity
<C extends ReplicaCollection<? extends C>> C sortedByProximity(InetAddressAndPort address, C addresses)
returns a new List sorted by proximity to the given endpoint
-
compareEndpoints
int compareEndpoints(InetAddressAndPort target, Replica r1, Replica r2)
compares two endpoints in relation to the target endpoint, returning as Comparator.compare would
-
gossiperStarting
void gossiperStarting()
called after Gossiper instance exists immediately before it starts gossiping
-
isWorthMergingForRangeQuery
boolean 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.
-
validate
default boolean validate(java.util.Set<java.lang.String> datacenters, java.util.Set<java.lang.String> racks)
Determine if the datacenter or rack values in the current node's snitch conflict with those passed in parameters.
-
-