org.apache.cassandra.locator
Class AbstractEndpointSnitch

java.lang.Object
  extended by org.apache.cassandra.locator.AbstractEndpointSnitch
All Implemented Interfaces:
IEndpointSnitch
Direct Known Subclasses:
AbstractNetworkTopologySnitch, DynamicEndpointSnitch, SimpleSnitch

public abstract class AbstractEndpointSnitch
extends java.lang.Object
implements IEndpointSnitch


Constructor Summary
AbstractEndpointSnitch()
           
 
Method Summary
abstract  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.List<java.net.InetAddress> getSortedListByProximity(java.net.InetAddress address, java.util.Collection<java.net.InetAddress> unsortedAddress)
          Sorts the Collection of node addresses by proximity to the given address
 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)
          Sorts the List of node addresses, in-place, by proximity to the given address
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cassandra.locator.IEndpointSnitch
getDatacenter, getRack
 

Constructor Detail

AbstractEndpointSnitch

public AbstractEndpointSnitch()
Method Detail

compareEndpoints

public abstract int compareEndpoints(java.net.InetAddress target,
                                     java.net.InetAddress a1,
                                     java.net.InetAddress a2)
Description copied from interface: IEndpointSnitch
compares two endpoints in relation to the target endpoint, returning as Comparator.compare would

Specified by:
compareEndpoints in interface IEndpointSnitch

getSortedListByProximity

public java.util.List<java.net.InetAddress> getSortedListByProximity(java.net.InetAddress address,
                                                                     java.util.Collection<java.net.InetAddress> unsortedAddress)
Sorts the Collection of node addresses by proximity to the given address

Specified by:
getSortedListByProximity in interface IEndpointSnitch
Parameters:
address - the address to sort by proximity to
unsortedAddress - the nodes to sort
Returns:
a new sorted List

sortByProximity

public void sortByProximity(java.net.InetAddress address,
                            java.util.List<java.net.InetAddress> addresses)
Sorts the List of node addresses, in-place, by proximity to the given address

Specified by:
sortByProximity in interface IEndpointSnitch
Parameters:
address - the address to sort the proximity by
addresses - the nodes to sort

gossiperStarting

public void gossiperStarting()
Description copied from interface: IEndpointSnitch
called after Gossiper instance exists immediately before it starts gossiping

Specified by:
gossiperStarting in interface IEndpointSnitch

isWorthMergingForRangeQuery

public boolean isWorthMergingForRangeQuery(java.util.List<java.net.InetAddress> merged,
                                           java.util.List<java.net.InetAddress> l1,
                                           java.util.List<java.net.InetAddress> l2)
Description copied from interface: IEndpointSnitch
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.

Specified by:
isWorthMergingForRangeQuery in interface IEndpointSnitch


Copyright © 2013 The Apache Software Foundation