org.apache.cassandra.dht
Class CollatingOrderPreservingPartitioner
java.lang.Object
org.apache.cassandra.dht.CollatingOrderPreservingPartitioner
- All Implemented Interfaces:
- IPartitioner<BytesToken>
public class CollatingOrderPreservingPartitioner
- extends java.lang.Object
- implements IPartitioner<BytesToken>
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MINIMUM
public static final BytesToken MINIMUM
CollatingOrderPreservingPartitioner
public CollatingOrderPreservingPartitioner()
decorateKey
public DecoratedKey<BytesToken> decorateKey(java.lang.String key)
- Description copied from interface:
IPartitioner
- Transform key to object representation of the on-disk format.
- Specified by:
decorateKey
in interface IPartitioner<BytesToken>
- Parameters:
key
- the raw, client-facing key
- Returns:
- decorated version of key
convertFromDiskFormat
public DecoratedKey<BytesToken> convertFromDiskFormat(java.lang.String key)
- Description copied from interface:
IPartitioner
- Convert the on disk representation to a DecoratedKey object
- Specified by:
convertFromDiskFormat
in interface IPartitioner<BytesToken>
- Parameters:
key
- On disk representation
- Returns:
- DecoratedKey object
convertToDiskFormat
public java.lang.String convertToDiskFormat(DecoratedKey<BytesToken> key)
- Description copied from interface:
IPartitioner
- Convert the DecoratedKey to the on disk format used for
this partitioner.
- Specified by:
convertToDiskFormat
in interface IPartitioner<BytesToken>
- Parameters:
key
- The DecoratedKey in question
- Returns:
getDecoratedKeyComparator
public java.util.Comparator<DecoratedKey<BytesToken>> getDecoratedKeyComparator()
- Specified by:
getDecoratedKeyComparator
in interface IPartitioner<BytesToken>
- Returns:
- a comparator for decorated key objects, not strings
midpoint
public BytesToken midpoint(BytesToken ltoken,
BytesToken rtoken)
- Description copied from interface:
IPartitioner
- Calculate a Token representing the approximate "middle" of the given
range.
The Tokens must have been generated by previous calls to midpoint,
or be equal to this.getMinimumToken(). The range may not wrap unless it
involves this.getMinimumToken().
- Specified by:
midpoint
in interface IPartitioner<BytesToken>
- Returns:
- The approximate midpoint between left and right.
getMinimumToken
public BytesToken getMinimumToken()
- Specified by:
getMinimumToken
in interface IPartitioner<BytesToken>
- Returns:
- The minimum possible Token in the range that is being partitioned.
getRandomToken
public BytesToken getRandomToken()
- Specified by:
getRandomToken
in interface IPartitioner<BytesToken>
- Returns:
- a randomly generated token
getTokenFactory
public Token.TokenFactory<byte[]> getTokenFactory()
- Specified by:
getTokenFactory
in interface IPartitioner<BytesToken>
preservesOrder
public boolean preservesOrder()
- Specified by:
preservesOrder
in interface IPartitioner<BytesToken>
- Returns:
- True if the implementing class preserves key order in the Tokens
it generates.
getToken
public BytesToken getToken(java.lang.String key)
- Specified by:
getToken
in interface IPartitioner<BytesToken>
- 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.)
Copyright © 2009 The Apache Software Foundation