org.apache.cassandra.dht
Interface IPartitioner<T extends Token>

All Known Implementing Classes:
AbstractByteOrderedPartitioner, ByteOrderedPartitioner, CollatingOrderPreservingPartitioner, LocalPartitioner, OrderPreservingPartitioner, RandomPartitioner

public interface IPartitioner<T extends Token>


Method Summary
 DecoratedKey<T> convertFromDiskFormat(java.nio.ByteBuffer key)
          Deprecated. Used by SSTables before version 'e'. Convert the on disk representation to a DecoratedKey object
 DecoratedKey<T> 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.
 T getMinimumToken()
           
 T getRandomToken()
           
 T getToken(java.nio.ByteBuffer key)
           
 Token.TokenFactory getTokenFactory()
           
 Token midpoint(Token left, Token right)
          Calculate a Token representing the approximate "middle" of the given range.
 boolean preservesOrder()
           
 

Method Detail

convertFromDiskFormat

DecoratedKey<T> convertFromDiskFormat(java.nio.ByteBuffer key)
Deprecated. Used by SSTables before version 'e'. Convert the on disk representation to a DecoratedKey object

Parameters:
key - On disk representation
Returns:
DecoratedKey object

decorateKey

DecoratedKey<T> 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.

getMinimumToken

T getMinimumToken()
Returns:
The minimum possible Token in the range that is being partitioned.

getToken

T 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

T getRandomToken()
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'.


Copyright © 2011 The Apache Software Foundation