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 Details

    • getRack

      String getRack(InetAddressAndPort endpoint)
      returns a String representing the rack the given endpoint belongs to
    • getLocalRack

      default String getLocalRack()
      returns a String representing the rack current endpoint belongs to
    • getDatacenter

      String getDatacenter(InetAddressAndPort endpoint)
      returns a String representing the datacenter the given endpoint belongs to
    • getLocalDatacenter

      default String getLocalDatacenter()
      returns a String representing the datacenter current endpoint belongs to
    • getDatacenter

      default String getDatacenter(InetSocketAddress endpoint)
    • getDatacenter

      default 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(Set<String> datacenters, Set<String> racks)
      Determine if the datacenter or rack values in the current node's snitch conflict with those passed in parameters.