Package org.apache.cassandra.locator
Class SimpleStrategy
java.lang.Object
org.apache.cassandra.locator.AbstractReplicationStrategy
org.apache.cassandra.locator.SimpleStrategy
This class returns the nodes responsible for a given
key but does not respect rack awareness. Basically
returns the RF nodes that lie right next to each other
on the ring.
-
Field Summary
FieldsFields inherited from class org.apache.cassandra.locator.AbstractReplicationStrategy
configOptions, keyspaceName, snitch -
Constructor Summary
ConstructorsConstructorDescriptionSimpleStrategy(String keyspaceName, TokenMetadata tokenMetadata, IEndpointSnitch snitch, Map<String, String> configOptions) -
Method Summary
Modifier and TypeMethodDescriptioncalculateNaturalReplicas(Token token, TokenMetadata metadata) Calculate the natural endpoints for the given token.calculate the RF based on strategy_options.voidmaybeWarnOnOptions(ClientState state) protected static voidvoidMethods inherited from class org.apache.cassandra.locator.AbstractReplicationStrategy
createReplicationStrategy, getAddressReplicas, getAddressReplicas, getAddressReplicas, getAddressReplicas, getCachedReplicas, getClass, getLocalReplicaFor, getNaturalReplicas, getNaturalReplicasForToken, getPendingAddressRanges, getPendingAddressRanges, getRangeAddresses, getWriteResponseHandler, getWriteResponseHandler, hasSameSettings, hasTransientReplicas, isTokenInLocalNaturalOrPendingRange, maybeWarnOnOptions, prepareReplicationStrategyOptions, validateExpectedOptions, validateReplicationFactor, validateReplicationStrategy
-
Field Details
-
REPLICATION_FACTOR
- See Also:
-
-
Constructor Details
-
SimpleStrategy
public SimpleStrategy(String keyspaceName, TokenMetadata tokenMetadata, IEndpointSnitch snitch, Map<String, String> configOptions)
-
-
Method Details
-
calculateNaturalReplicas
Description copied from class:AbstractReplicationStrategyCalculate the natural endpoints for the given token. Endpoints are returned in the order they occur in the ring following the searchToken, as defined by the replication strategy. Note that the order of the replicas is _implicitly relied upon_ by the definition of "primary" range inStorageService.getPrimaryRangesForEndpoint(String, InetAddressAndPort)which is in turn relied on by various components like repair and size estimate calculations.- Specified by:
calculateNaturalReplicasin classAbstractReplicationStrategy- Parameters:
token- the token to find the natural endpoints formetadata- the token metadata used to find the searchToken, e.g. contains token to endpoint mapping information- Returns:
- a copy of the natural endpoints for the given token
- See Also:
-
getReplicationFactor
Description copied from class:AbstractReplicationStrategycalculate the RF based on strategy_options. When overwriting, ensure that this get() is FAST, as this is called often.- Specified by:
getReplicationFactorin classAbstractReplicationStrategy- Returns:
- the replication factor
-
validateOptions
- Specified by:
validateOptionsin classAbstractReplicationStrategy- Throws:
ConfigurationException
-
maybeWarnOnOptions
- Overrides:
maybeWarnOnOptionsin classAbstractReplicationStrategy
-
recognizedOptions
- Overrides:
recognizedOptionsin classAbstractReplicationStrategy
-
prepareOptions
-