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
Modifier and TypeMethodDescriptionintcompareEndpoints(InetAddressAndPort target, Replica r1, Replica r2) compares two endpoints in relation to the target endpoint, returning as Comparator.compare woulddefault StringgetDatacenter(InetSocketAddress endpoint) getDatacenter(InetAddressAndPort endpoint) returns a String representing the datacenter the given endpoint belongs todefault StringgetDatacenter(Replica replica) default Stringreturns a String representing the datacenter current endpoint belongs todefault Stringreturns a String representing the rack current endpoint belongs togetRack(InetAddressAndPort endpoint) returns a String representing the rack the given endpoint belongs tovoidcalled after Gossiper instance exists immediately before it starts gossipingbooleanisWorthMergingForRangeQuery(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 booleanDetermine if the datacenter or rack values in the current node's snitch conflict with those passed in parameters.
-
Method Details
-
getRack
returns a String representing the rack the given endpoint belongs to -
getLocalRack
returns a String representing the rack current endpoint belongs to -
getDatacenter
returns a String representing the datacenter the given endpoint belongs to -
getLocalDatacenter
returns a String representing the datacenter current endpoint belongs to -
getDatacenter
-
getDatacenter
-
sortedByProximity
<C extends ReplicaCollection<? extends C>> C sortedByProximity(InetAddressAndPort address, C addresses) returns a new List sorted by proximity to the given endpoint -
compareEndpoints
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
Determine if the datacenter or rack values in the current node's snitch conflict with those passed in parameters.
-