Package org.apache.cassandra.locator
Class SimpleSnitch
java.lang.Object
org.apache.cassandra.locator.AbstractEndpointSnitch
org.apache.cassandra.locator.SimpleSnitch
- All Implemented Interfaces:
IEndpointSnitch
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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompareEndpoints(InetAddressAndPort target, Replica r1, Replica r2) compares two endpoints in relation to the target endpoint, returning as Comparator.compare wouldgetDatacenter(InetAddressAndPort endpoint) returns a String representing the datacenter the given endpoint belongs togetRack(InetAddressAndPort endpoint) returns a String representing the rack the given endpoint belongs to<C extends ReplicaCollection<? extends C>>
CsortedByProximity(InetAddressAndPort address, C unsortedAddress) Sorts the Collection of node addresses by proximity to the given addressMethods inherited from class org.apache.cassandra.locator.AbstractEndpointSnitch
gossiperStarting, isWorthMergingForRangeQueryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cassandra.locator.IEndpointSnitch
getDatacenter, getDatacenter, getLocalDatacenter, getLocalRack, validate
-
Field Details
-
DATA_CENTER_NAME
- See Also:
-
RACK_NAME
- See Also:
-
-
Constructor Details
-
SimpleSnitch
public SimpleSnitch()
-
-
Method Details
-
getRack
Description copied from interface:IEndpointSnitchreturns a String representing the rack the given endpoint belongs to -
getDatacenter
Description copied from interface:IEndpointSnitchreturns a String representing the datacenter the given endpoint belongs to -
sortedByProximity
public <C extends ReplicaCollection<? extends C>> C sortedByProximity(InetAddressAndPort address, C unsortedAddress) Description copied from class:AbstractEndpointSnitchSorts the Collection of node addresses by proximity to the given address- Specified by:
sortedByProximityin interfaceIEndpointSnitch- Overrides:
sortedByProximityin classAbstractEndpointSnitch- Parameters:
address- the address to sort by proximity tounsortedAddress- the nodes to sort- Returns:
- a new sorted List
-
compareEndpoints
Description copied from interface:IEndpointSnitchcompares two endpoints in relation to the target endpoint, returning as Comparator.compare would- Specified by:
compareEndpointsin interfaceIEndpointSnitch- Specified by:
compareEndpointsin classAbstractEndpointSnitch
-