org.apache.cassandra.locator
Class NetworkTopologyStrategy
java.lang.Object
org.apache.cassandra.locator.AbstractReplicationStrategy
org.apache.cassandra.locator.NetworkTopologyStrategy
public class NetworkTopologyStrategy
- extends AbstractReplicationStrategy
This Replication Strategy takes a property file that gives the intended
replication factor in each datacenter. The sum total of the datacenter
replication factor values should be equal to the keyspace replication
factor.
So for example, if the keyspace replication factor is 6, the
datacenter replication factors could be 3, 2, and 1 - so 3 replicas in
one datacenter, 2 in another, and 1 in another - totalling 6.
This class also caches the Endpoints and invalidates the cache if there is a
change in the number of tokens.
Methods inherited from class org.apache.cassandra.locator.AbstractReplicationStrategy |
cacheEndpoint, clearEndpointCache, createReplicationStrategy, createReplicationStrategy, getAddressRanges, getAddressRanges, getCachedEndpoints, getClass, getHintedEndpoints, getNaturalEndpoints, getPendingAddressRanges, getQuorumResponseHandler, getRangeAddresses, invalidateCachedTokenEndpointValues |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NetworkTopologyStrategy
public NetworkTopologyStrategy(java.lang.String table,
TokenMetadata tokenMetadata,
IEndpointSnitch snitch,
java.util.Map<java.lang.String,java.lang.String> configOptions)
throws ConfigurationException
- Throws:
ConfigurationException
calculateNaturalEndpoints
public java.util.List<java.net.InetAddress> calculateNaturalEndpoints(Token searchToken,
TokenMetadata tokenMetadata)
- Description copied from class:
AbstractReplicationStrategy
- calculate the natural endpoints for the given token
- Specified by:
calculateNaturalEndpoints
in class AbstractReplicationStrategy
- Parameters:
searchToken
- the token the natural endpoints are requested for
- Returns:
- a copy of the natural endpoints for the given token
- See Also:
AbstractReplicationStrategy.getNaturalEndpoints(org.apache.cassandra.dht.Token)
getReplicationFactor
public int getReplicationFactor()
- Overrides:
getReplicationFactor
in class AbstractReplicationStrategy
getReplicationFactor
public int getReplicationFactor(java.lang.String dc)
getDatacenters
public java.util.Set<java.lang.String> getDatacenters()
getWriteResponseHandler
public IWriteResponseHandler getWriteResponseHandler(java.util.Collection<java.net.InetAddress> writeEndpoints,
com.google.common.collect.Multimap<java.net.InetAddress,java.net.InetAddress> hintedEndpoints,
ConsistencyLevel consistency_level)
- This method will generate the QRH object and returns. If the Consistency
level is LOCAL_QUORUM then it will return a DCQRH with a map of local rep
factor alone. If the consistency level is EACH_QUORUM then it will
return a DCQRH with a map of all the DC rep factor.
- Overrides:
getWriteResponseHandler
in class AbstractReplicationStrategy
Copyright © 2010 The Apache Software Foundation