## org.apache.cassandra.locator
Class AbstractReplicationStrategy

    java.lang.Object
      org.apache.cassandra.locator.AbstractReplicationStrategy

Direct Known Subclasses:
  RackAwareStrategy, RackUnawareStrategy

    public abstract class AbstractReplicationStrategy

extends java.lang.Object

This class contains a helper method that will be used by all abstraction that implement the IReplicaPlacementStrategy interface.

Field Summary
`protected static org.apache.log4j.Logger` `logger_`
`protected IEndPointSnitch` `snitch_`

Method Summary
`com.google.common.collect.Multimap<java.net.InetAddress,Range>` `getAddressRanges(java.lang.String table)`
`com.google.common.collect.Multimap<java.net.InetAddress,Range>` `getAddressRanges(TokenMetadata metadata, java.lang.String table)`
`com.google.common.collect.Multimap<java.net.InetAddress,java.net.InetAddress>` `getHintedEndpoints(java.lang.String table, java.util.Collection<java.net.InetAddress> targets)` returns multimap of {live destination: ultimate targets}, where if target is not the same as the destination, it is a "hinted" write, and will need to be sent to the ultimate target when it becomes alive again.
`java.util.ArrayList<java.net.InetAddress>` `getNaturalEndpoints(Token token, java.lang.String table)`
`abstract java.util.ArrayList<java.net.InetAddress>` `getNaturalEndpoints(Token token, TokenMetadata metadata, java.lang.String table)` get the endpoints that should store the given Token, for the given table.
`java.util.Collection<Range>` `getPendingAddressRanges(TokenMetadata metadata, Token pendingToken, java.net.InetAddress pendingAddress, java.lang.String table)`
`com.google.common.collect.Multimap<Range,java.net.InetAddress>` `getRangeAddresses(TokenMetadata metadata, java.lang.String table)`

`java.util.Collection<java.net.InetAddress>`

`getWriteEndpoints(Token token, java.lang.String table, java.util.Collection<java.net.InetAddress> naturalEndpoints)`
write endpoints may be different from read endpoints, because read endpoints only need care about the "natural" nodes for a token, but write endpoints also need to account for nodes that are bootstrapping into the ring, and write data there too so that they stay up to date during the bootstrap process.

`WriteResponseHandler` `getWriteResponseHandler(int blockFor, ConsistencyLevel consistency_level, java.lang.String table)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### logger_

    protected static final org.apache.log4j.Logger logger_

### snitch_

    protected final IEndPointSnitch snitch_

Method Detail

### getNaturalEndpoints

    public abstract java.util.ArrayList<java.net.InetAddress> getNaturalEndpoints(Token token,
                                                                                  TokenMetadata metadata,
                                                                                  java.lang.String table)

  get the endpoints that should store the given Token, for the given table. Note that while the endpoints are conceptually a Set (no duplicates will be included), we return a List to avoid an extra allocation when sorting by proximity later.

### getWriteResponseHandler

    public WriteResponseHandler getWriteResponseHandler(int blockFor,
                                                        ConsistencyLevel consistency_level,
                                                        java.lang.String table)

### getNaturalEndpoints

    public java.util.ArrayList<java.net.InetAddress> getNaturalEndpoints(Token token,
                                                                         java.lang.String table)

### getHintedEndpoints

    public com.google.common.collect.Multimap<java.net.InetAddress,java.net.InetAddress> getHintedEndpoints(java.lang.String table,
                                                                                                            java.util.Collection<java.net.InetAddress> targets)

  returns multimap of {live destination: ultimate targets}, where if target is not the same as the destination, it is a "hinted" write, and will need to be sent to the ultimate target when it becomes alive again.

### getWriteEndpoints

    public java.util.Collection<java.net.InetAddress> getWriteEndpoints(Token token,
                                                                        java.lang.String table,
                                                                        java.util.Collection<java.net.InetAddress> naturalEndpoints)

  write endpoints may be different from read endpoints, because read endpoints only need care about the "natural" nodes for a token, but write endpoints also need to account for nodes that are bootstrapping into the ring, and write data there too so that they stay up to date during the bootstrap process. Thus, this method may return more nodes than the Replication Factor. If possible, will return the same collection it was passed, for efficiency. Only ReplicationStrategy should care about this method (higher level users should only ask for Hinted). todo: this method should be moved into TokenMetadata.

### getAddressRanges

    public com.google.common.collect.Multimap<java.net.InetAddress,Range> getAddressRanges(TokenMetadata metadata,
                                                                                           java.lang.String table)

### getRangeAddresses

    public com.google.common.collect.Multimap<Range,java.net.InetAddress> getRangeAddresses(TokenMetadata metadata,
                                                                                            java.lang.String table)

### getAddressRanges

    public com.google.common.collect.Multimap<java.net.InetAddress,Range> getAddressRanges(java.lang.String table)

### getPendingAddressRanges

    public java.util.Collection<Range> getPendingAddressRanges(TokenMetadata metadata,
                                                               Token pendingToken,
                                                               java.net.InetAddress pendingAddress,
                                                               java.lang.String table)

Copyright © 2010 The Apache Software Foundation