org.apache.cassandra.locator

## Interface IEndpointSnitch

- All Known Implementing Classes:
    AbstractEndpointSnitch, AbstractNetworkTopologySnitch, CloudstackSnitch, DynamicEndpointSnitch, Ec2MultiRegionSnitch, Ec2Snitch, GoogleCloudSnitch, GossipingPropertyFileSnitch, PropertyFileSnitch, RackInferringSnitch, SimpleSnitch

      public interface IEndpointSnitch

  This interface helps determine location of node in the data center 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 data center.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareEndpoints(java.net.InetAddress target, java.net.InetAddress a1, java.net.InetAddress a2)` compares two endpoints in relation to the target endpoint, returning as Comparator.compare would
    `java.lang.String` | `getDatacenter(java.net.InetAddress endpoint)` returns a String representing the datacenter this endpoint belongs to
    `java.lang.String` | `getRack(java.net.InetAddress endpoint)` returns a String repesenting the rack this endpoint belongs to
    `java.util.List<java.net.InetAddress>` | `getSortedListByProximity(java.net.InetAddress address, java.util.Collection<java.net.InetAddress> unsortedAddress)` returns a new `List` sorted by proximity to the given endpoint
    `void` | `gossiperStarting()` called after Gossiper instance exists immediately before it starts gossiping
    `boolean` | `isWorthMergingForRangeQuery(java.util.List<java.net.InetAddress> merged, java.util.List<java.net.InetAddress> l1, java.util.List<java.net.InetAddress> 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.
    `void` | `sortByProximity(java.net.InetAddress address, java.util.List<java.net.InetAddress> addresses)` This method will sort the `List` by proximity to the given address.

- - ### Method Detail

    - #### getRack

          java.lang.String getRack(java.net.InetAddress endpoint)

      returns a String repesenting the rack this endpoint belongs to

    - #### getDatacenter

          java.lang.String getDatacenter(java.net.InetAddress endpoint)

      returns a String representing the datacenter this endpoint belongs to

    - #### getSortedListByProximity

          java.util.List<java.net.InetAddress> getSortedListByProximity(java.net.InetAddress address,
                                                                        java.util.Collection<java.net.InetAddress> unsortedAddress)

      returns a new `List` sorted by proximity to the given endpoint

    - #### sortByProximity

          void sortByProximity(java.net.InetAddress address,
                               java.util.List<java.net.InetAddress> addresses)

      This method will sort the `List` by proximity to the given address.

    - #### compareEndpoints

          int compareEndpoints(java.net.InetAddress target,
                               java.net.InetAddress a1,
                               java.net.InetAddress a2)

      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(java.util.List<java.net.InetAddress> merged,
                                              java.util.List<java.net.InetAddress> l1,
                                              java.util.List<java.net.InetAddress> 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.

Copyright © 2018 The Apache Software Foundation