org.apache.cassandra.dht
Class LocalPartitioner
java.lang.Object
org.apache.cassandra.dht.LocalPartitioner
- All Implemented Interfaces:
- IPartitioner<LocalToken>
public class LocalPartitioner
- extends java.lang.Object
- implements IPartitioner<LocalToken>
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LocalPartitioner
public LocalPartitioner(AbstractType comparator)
convertFromDiskFormat
public DecoratedKey<LocalToken> convertFromDiskFormat(java.nio.ByteBuffer key)
- Specified by:
convertFromDiskFormat
in interface IPartitioner<LocalToken>
- Parameters:
key
- On disk representation
- Returns:
- DecoratedKey object
decorateKey
public DecoratedKey<LocalToken> decorateKey(java.nio.ByteBuffer key)
- Description copied from interface:
IPartitioner
- Transform key to object representation of the on-disk format.
- Specified by:
decorateKey
in interface IPartitioner<LocalToken>
- Parameters:
key
- the raw, client-facing key
- Returns:
- decorated version of key
midpoint
public Token midpoint(Token left,
Token right)
- Description copied from interface:
IPartitioner
- Calculate a Token representing the approximate "middle" of the given
range.
- Specified by:
midpoint
in interface IPartitioner<LocalToken>
- Returns:
- The approximate midpoint between left and right.
getMinimumToken
public LocalToken getMinimumToken()
- Specified by:
getMinimumToken
in interface IPartitioner<LocalToken>
- Returns:
- The minimum possible Token in the range that is being partitioned.
getToken
public LocalToken getToken(java.nio.ByteBuffer key)
- Specified by:
getToken
in interface IPartitioner<LocalToken>
- 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 LocalToken getRandomToken()
- Specified by:
getRandomToken
in interface IPartitioner<LocalToken>
- Returns:
- a randomly generated token
getTokenFactory
public Token.TokenFactory getTokenFactory()
- Specified by:
getTokenFactory
in interface IPartitioner<LocalToken>
preservesOrder
public boolean preservesOrder()
- Specified by:
preservesOrder
in interface IPartitioner<LocalToken>
- 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.
- Specified by:
describeOwnership
in interface IPartitioner<LocalToken>
- Parameters:
sortedTokens
- a sorted List of Tokens
- Returns:
- the mapping from 'token' to 'percentage of the ring owned by that token'.
Copyright © 2011 The Apache Software Foundation