org.apache.cassandra.dht
Class Murmur3Partitioner
java.lang.Object
org.apache.cassandra.dht.AbstractPartitioner<LongToken>
org.apache.cassandra.dht.Murmur3Partitioner
- All Implemented Interfaces:
- IPartitioner<LongToken>
public class Murmur3Partitioner
- extends AbstractPartitioner<LongToken>
This class generates a BigIntegerToken using a Murmur3 hash.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MINIMUM
public static final LongToken MINIMUM
MAXIMUM
public static final long MAXIMUM
- See Also:
- Constant Field Values
Murmur3Partitioner
public Murmur3Partitioner()
convertFromDiskFormat
public DecoratedKey convertFromDiskFormat(java.nio.ByteBuffer key)
- Parameters:
key
- On disk representation
- Returns:
- DecoratedKey object
decorateKey
public DecoratedKey decorateKey(java.nio.ByteBuffer key)
- Description copied from interface:
IPartitioner
- Transform key to object representation of the on-disk format.
- Parameters:
key
- the raw, client-facing key
- Returns:
- decorated version of key
midpoint
public Token midpoint(Token lToken,
Token rToken)
- Description copied from interface:
IPartitioner
- Calculate a Token representing the approximate "middle" of the given
range.
- Returns:
- The approximate midpoint between left and right.
getMinimumToken
public LongToken getMinimumToken()
- Returns:
- The minimum possible Token in the range that is being partitioned.
getToken
public LongToken getToken(java.nio.ByteBuffer key)
- Generate the token of a key.
Note that we need to ensure all generated token are strictly bigger than MINIMUM.
In particular we don't want MINIMUM to correspond to any key because the range (MINIMUM, X] doesn't
include MINIMUM but we use such range to select all data whose token is smaller than X.
- 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
public LongToken getRandomToken()
- Returns:
- a randomly generated token
preservesOrder
public boolean preservesOrder()
- Returns:
- True if the implementing class preserves key order in the Tokens
it generates.
describeOwnership
public java.util.Map<Token,java.lang.Float> describeOwnership(java.util.List<Token> sortedTokens)
- Description copied from interface:
IPartitioner
- 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'.
getTokenFactory
public Token.TokenFactory<java.lang.Long> getTokenFactory()
getTokenValidator
public AbstractType<?> getTokenValidator()
Copyright © 2013 The Apache Software Foundation