org.apache.cassandra.locator
Interface IEndpointSnitch

All Known Implementing Classes:
AbstractEndpointSnitch, AbstractNetworkTopologySnitch, DynamicEndpointSnitch, 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
 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 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



Copyright © 2010 The Apache Software Foundation