LocalStrategy (apache-cassandra API)
Date: 2014-10-21

org.apache.cassandra.locator

## Class LocalStrategy

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

-     public class LocalStrategy
      extends AbstractReplicationStrategy

- - ### Field Summary

    - ### Fields inherited from class org.apache.cassandra.locator.AbstractReplicationStrategy

      `configOptions, snitch`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LocalStrategy(java.lang.String keyspaceName, TokenMetadata tokenMetadata, IEndpointSnitch snitch, java.util.Map<java.lang.String,java.lang.String> configOptions)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.List<java.net.InetAddress>` | `calculateNaturalEndpoints(Token token, TokenMetadata metadata)` calculate the natural endpoints for the given token
    `java.util.ArrayList<java.net.InetAddress>` | `getNaturalEndpoints(RingPosition searchPosition)` We need to override this even if we override calculateNaturalEndpoints, because the default implementation depends on token calculations but LocalStrategy may be used before tokens are set up.
    `int` | `getReplicationFactor()` calculate the RF based on strategy_options.
    `java.util.Collection<java.lang.String>` | `recognizedOptions()`
    `void` | `validateOptions()`

    - ### Methods inherited from class org.apache.cassandra.locator.AbstractReplicationStrategy

      `createReplicationStrategy, getAddressRanges, getAddressRanges, getCachedEndpoints, getClass, getPendingAddressRanges, getPendingAddressRanges, getRangeAddresses, getWriteResponseHandler, validateReplicationFactor, validateReplicationStrategy`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LocalStrategy

          public LocalStrategy(java.lang.String keyspaceName,
                       TokenMetadata tokenMetadata,
                       IEndpointSnitch snitch,
                       java.util.Map<java.lang.String,java.lang.String> configOptions)

  - ### Method Detail

    - #### getNaturalEndpoints

          public java.util.ArrayList<java.net.InetAddress> getNaturalEndpoints(RingPosition searchPosition)

      We need to override this even if we override calculateNaturalEndpoints, because the default implementation depends on token calculations but LocalStrategy may be used before tokens are set up.
      Overrides:
        `getNaturalEndpoints` in class `AbstractReplicationStrategy`
      Parameters:
        `searchPosition` - the position the natural endpoints are requested for
      Returns:
        a copy of the natural endpoints for the given token

    - #### calculateNaturalEndpoints

          public java.util.List<java.net.InetAddress> calculateNaturalEndpoints(Token token,
                                                                       TokenMetadata metadata)

      Description copied from class: `AbstractReplicationStrategy`
      calculate the natural endpoints for the given token
      Specified by:
        `calculateNaturalEndpoints` in class `AbstractReplicationStrategy`
      Parameters:
        `token` - 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.RingPosition)`

    - #### getReplicationFactor

          public int getReplicationFactor()

      Description copied from class: `AbstractReplicationStrategy`
      calculate the RF based on strategy_options. When overwriting, ensure that this get() is FAST, as this is called often.
      Specified by:
        `getReplicationFactor` in class `AbstractReplicationStrategy`
      Returns:
        the replication factor

    - #### validateOptions

          public void validateOptions()
                               throws ConfigurationException

      Specified by:
        `validateOptions` in class `AbstractReplicationStrategy`
      Throws:
        `ConfigurationException`

    - #### recognizedOptions

          public java.util.Collection<java.lang.String> recognizedOptions()

      Overrides:
        `recognizedOptions` in class `AbstractReplicationStrategy`

Copyright © 2014 The Apache Software Foundation