org.apache.cassandra.locator
Class SimpleSnitch
java.lang.Object
org.apache.cassandra.locator.AbstractEndpointSnitch
org.apache.cassandra.locator.SimpleSnitch
- All Implemented Interfaces:
- IEndpointSnitch
public class SimpleSnitch
- extends AbstractEndpointSnitch
A simple endpoint snitch implementation that treats Strategy order as proximity,
allowing non-read-repaired reads to prefer a single endpoint, which improves
cache locality.
Method Summary |
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> addresses)
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimpleSnitch
public SimpleSnitch()
getRack
public java.lang.String getRack(java.net.InetAddress endpoint)
- Description copied from interface:
IEndpointSnitch
- returns a String repesenting the rack this endpoint belongs to
getDatacenter
public java.lang.String getDatacenter(java.net.InetAddress endpoint)
- Description copied from interface:
IEndpointSnitch
- returns a String representing the datacenter this endpoint belongs to
getSortedListByProximity
public java.util.List<java.net.InetAddress> getSortedListByProximity(java.net.InetAddress address,
java.util.Collection<java.net.InetAddress> addresses)
- Description copied from interface:
IEndpointSnitch
- returns a new List sorted by proximity to the given endpoint
- Specified by:
getSortedListByProximity
in interface IEndpointSnitch
- Specified by:
getSortedListByProximity
in class AbstractEndpointSnitch
sortByProximity
public java.util.List<java.net.InetAddress> sortByProximity(java.net.InetAddress address,
java.util.List<java.net.InetAddress> addresses)
- Description copied from interface:
IEndpointSnitch
- This method will sort the List by proximity to the given address.
- Specified by:
sortByProximity
in interface IEndpointSnitch
- Specified by:
sortByProximity
in class AbstractEndpointSnitch
Copyright © 2010 The Apache Software Foundation