org.apache.cassandra.locator
Class DatacenterShardStategy
java.lang.Object
org.apache.cassandra.locator.AbstractReplicationStrategy
org.apache.cassandra.locator.DatacenterShardStategy
public class DatacenterShardStategy
- extends AbstractReplicationStrategy
This Stategy is little diffrent than the Rack aware Statergy. If there is
replication factor is N. We will make sure that (N-1)%2 of the nodes are in
other Datacenter.... For example if we have 5 nodes this stategy will make
sure to make 2 copies out of 5 in other dataceneter.
This class also caches the EndPoints and invalidates the cache if there is a
change in the number of tokens.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DatacenterShardStategy
public DatacenterShardStategy(TokenMetadata tokenMetadata,
IPartitioner<Token> partitioner,
int replicas)
throws java.net.UnknownHostException
- Throws:
java.net.UnknownHostException
getNaturalEndpoints
public java.util.ArrayList<java.net.InetAddress> getNaturalEndpoints(Token token,
TokenMetadata metadata)
- Specified by:
getNaturalEndpoints
in class AbstractReplicationStrategy
getWriteResponseHandler
public WriteResponseHandler getWriteResponseHandler(int blockFor,
int consistency_level)
- This method will generate the QRH object and returns. If the Consistency
level is DCQUORUM then it will return a DCQRH with a map of local rep
factor alone. If the consistency level is DCQUORUMSYNC then it will
return a DCQRH with a map of all the DC rep facor.
- Overrides:
getWriteResponseHandler
in class AbstractReplicationStrategy
Copyright © 2010 The Apache Software Foundation