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
 void cacheEndpoint(Token t, java.util.ArrayList<java.net.InetAddress> addr)
          puts an address in the cache for a given token.
 void clearEndpointCache()
          clears all cache values.
 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.util.ArrayList<java.net.InetAddress> getCachedEndpoints(Token t)
          returns a list of cached endpoints for a given token.
 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
 java.util.List<java.net.InetAddress> 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

java.util.List<java.net.InetAddress> 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


getCachedEndpoints

java.util.ArrayList<java.net.InetAddress> getCachedEndpoints(Token t)
returns a list of cached endpoints for a given token.


cacheEndpoint

void cacheEndpoint(Token t,
                   java.util.ArrayList<java.net.InetAddress> addr)
puts an address in the cache for a given token.


clearEndpointCache

void clearEndpointCache()
clears all cache values.



Copyright © 2010 The Apache Software Foundation