Package org.apache.cassandra.dht
Interface IPartitioner
-
- All Known Implementing Classes:
ByteOrderedPartitioner
,LocalPartitioner
,Murmur3Partitioner
,OrderPreservingPartitioner
,RandomPartitioner
public interface IPartitioner
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description DecoratedKey
decorateKey(java.nio.ByteBuffer key)
Transform key to object representation of the on-disk format.java.util.Map<Token,java.lang.Float>
describeOwnership(java.util.List<Token> sortedTokens)
Calculate the deltas between tokens in the ring in order to compare relative sizes.default Token
getMaximumToken()
The biggest token for this partitioner, unlike getMinimumToken, this token is actually used and users wanting to include all tokens need to do getMaximumToken().maxKeyBound() Not implemented for the ordered partitionersdefault int
getMaxTokenSize()
Token
getMinimumToken()
Token
getRandomToken()
Token
getRandomToken(java.util.Random random)
Token
getToken(java.nio.ByteBuffer key)
Token.TokenFactory
getTokenFactory()
AbstractType<?>
getTokenValidator()
static IPartitioner
global()
Token
midpoint(Token left, Token right)
Calculate a Token representing the approximate "middle" of the given range.AbstractType<?>
partitionOrdering()
Deprecated.See CASSANDRA-17698default AbstractType<?>
partitionOrdering(AbstractType<?> partitionKeyType)
Abstract type that orders the same way as DecoratedKeys provided by this partitioner.boolean
preservesOrder()
Token
split(Token left, Token right, double ratioToLeft)
Calculate a Token which takeapproximate 0 <= ratioToLeft <= 1
ownership of the given range.default java.util.Optional<Splitter>
splitter()
static void
validate(java.util.Collection<? extends AbstractBounds<?>> allBounds)
static void
validate(AbstractBounds<?> bounds)
-
-
-
Method Detail
-
global
static IPartitioner global()
-
validate
static void validate(java.util.Collection<? extends AbstractBounds<?>> allBounds)
-
validate
static void validate(AbstractBounds<?> bounds)
-
decorateKey
DecoratedKey decorateKey(java.nio.ByteBuffer key)
Transform key to object representation of the on-disk format.- Parameters:
key
- the raw, client-facing key- Returns:
- decorated version of key
-
midpoint
Token midpoint(Token left, Token right)
Calculate a Token representing the approximate "middle" of the given range.- Returns:
- The approximate midpoint between left and right.
-
split
Token split(Token left, Token right, double ratioToLeft)
Calculate a Token which takeapproximate 0 <= ratioToLeft <= 1
ownership of the given range.
-
getMinimumToken
Token getMinimumToken()
- Returns:
- A Token smaller than all others in the range that is being partitioned. Not legal to assign to a node or key. (But legal to use in range scans.)
-
getMaximumToken
default Token getMaximumToken()
The biggest token for this partitioner, unlike getMinimumToken, this token is actually used and users wanting to include all tokens need to do getMaximumToken().maxKeyBound() Not implemented for the ordered partitioners
-
getToken
Token getToken(java.nio.ByteBuffer key)
- Returns:
- a Token that can be used to route a given key (This is NOT a method to create a Token from its string representation; for that, use TokenFactory.fromString.)
-
getRandomToken
Token getRandomToken()
- Returns:
- a randomly generated token
-
getRandomToken
Token getRandomToken(java.util.Random random)
- Parameters:
random
- instance of Random to use when generating the token- Returns:
- a randomly generated token
-
getTokenFactory
Token.TokenFactory getTokenFactory()
-
preservesOrder
boolean preservesOrder()
- Returns:
- True if the implementing class preserves key order in the Tokens it generates.
-
describeOwnership
java.util.Map<Token,java.lang.Float> describeOwnership(java.util.List<Token> sortedTokens)
Calculate the deltas between tokens in the ring in order to compare relative sizes.- Parameters:
sortedTokens
- a sorted List of Tokens- Returns:
- the mapping from 'token' to 'percentage of the ring owned by that token'.
-
getTokenValidator
AbstractType<?> getTokenValidator()
-
partitionOrdering
@Deprecated(since="5.0") AbstractType<?> partitionOrdering()
Deprecated.See CASSANDRA-17698
-
partitionOrdering
default AbstractType<?> partitionOrdering(@Nullable AbstractType<?> partitionKeyType)
Abstract type that orders the same way as DecoratedKeys provided by this partitioner. Used by secondary indices.- Parameters:
partitionKeyType
- partition key type for PartitionerDefinedOrder
-
splitter
default java.util.Optional<Splitter> splitter()
-
getMaxTokenSize
default int getMaxTokenSize()
-
-