org.apache.cassandra.locator
Interface IEndPointSnitch

All Known Implementing Classes:
DatacenterEndPointSnitch, EndPointSnitch

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. Not all methods will be germate to all implementations. Throw UnsupportedOperation as necessary.


Method Summary
 java.lang.String getLocation(java.net.InetAddress endpoint)
          Given endpoints this method will help us know the datacenter name where the node is located at.
 boolean isInSameDataCenter(java.net.InetAddress host, java.net.InetAddress host2)
          Helps determine if 2 nodes are in the same data center.
 boolean isOnSameRack(java.net.InetAddress host, java.net.InetAddress host2)
          Helps determine if 2 nodes are in the same rack in the data center.
 java.util.List<java.net.InetAddress> sortByProximity(java.net.InetAddress address, java.util.Collection<java.net.InetAddress> unsortedAddress)
          This method will sort the Set according to the proximity of the given address.
 

Method Detail

isOnSameRack

boolean isOnSameRack(java.net.InetAddress host,
                     java.net.InetAddress host2)
                     throws java.net.UnknownHostException
Helps determine if 2 nodes are in the same rack in the data center.

Parameters:
host - a specified endpoint
host2 - another specified endpoint
Returns:
true if on the same rack false otherwise
Throws:
java.net.UnknownHostException

isInSameDataCenter

boolean isInSameDataCenter(java.net.InetAddress host,
                           java.net.InetAddress host2)
                           throws java.net.UnknownHostException
Helps determine if 2 nodes are in the same data center.

Parameters:
host - a specified endpoint
host2 - another specified endpoint
Returns:
true if in the same data center false otherwise
Throws:
java.net.UnknownHostException

getLocation

java.lang.String getLocation(java.net.InetAddress endpoint)
                             throws java.net.UnknownHostException
Given endpoints this method will help us know the datacenter name where the node is located at.

Throws:
java.net.UnknownHostException

sortByProximity

java.util.List<java.net.InetAddress> sortByProximity(java.net.InetAddress address,
                                                     java.util.Collection<java.net.InetAddress> unsortedAddress)
This method will sort the Set according to the proximity of the given address.



Copyright © 2009 The Apache Software Foundation