org.apache.cassandra.dht
Class CollatingOrderPreservingPartitioner

java.lang.Object
  extended by org.apache.cassandra.dht.CollatingOrderPreservingPartitioner
All Implemented Interfaces:
IPartitioner<BytesToken>

public class CollatingOrderPreservingPartitioner
extends java.lang.Object
implements IPartitioner<BytesToken>


Field Summary
static BytesToken MINIMUM
           
 
Constructor Summary
CollatingOrderPreservingPartitioner()
           
 
Method Summary
 java.lang.String decorateKey(java.lang.String key)
          Transform key to on-disk format s.t.
 java.util.Comparator<java.lang.String> getDecoratedKeyComparator()
           
 BytesToken getDefaultToken()
           
 BytesToken getMinimumToken()
           
 java.util.Comparator<java.lang.String> getReverseDecoratedKeyComparator()
           
 BytesToken getToken(java.lang.String key)
           
 Token.TokenFactory<byte[]> getTokenFactory()
           
 BytesToken midpoint(BytesToken ltoken, BytesToken rtoken)
          Calculate a Token representing the approximate "middle" of the given range.
 boolean preservesOrder()
           
 java.lang.String undecorateKey(java.lang.String decoratedKey)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MINIMUM

public static final BytesToken MINIMUM
Constructor Detail

CollatingOrderPreservingPartitioner

public CollatingOrderPreservingPartitioner()
Method Detail

decorateKey

public java.lang.String decorateKey(java.lang.String key)
Description copied from interface: IPartitioner
Transform key to on-disk format s.t. keys are stored in node comparison order. This lets bootstrap rip out parts of the sstable sequentially instead of doing random seeks.

Specified by:
decorateKey in interface IPartitioner<BytesToken>
Parameters:
key - the raw, client-facing key
Returns:
decorated on-disk version of key

undecorateKey

public java.lang.String undecorateKey(java.lang.String decoratedKey)
Specified by:
undecorateKey in interface IPartitioner<BytesToken>

getDecoratedKeyComparator

public java.util.Comparator<java.lang.String> getDecoratedKeyComparator()
Specified by:
getDecoratedKeyComparator in interface IPartitioner<BytesToken>

getReverseDecoratedKeyComparator

public java.util.Comparator<java.lang.String> getReverseDecoratedKeyComparator()
Specified by:
getReverseDecoratedKeyComparator in interface IPartitioner<BytesToken>

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.

getDefaultToken

public BytesToken getDefaultToken()
Specified by:
getDefaultToken in interface IPartitioner<BytesToken>
Returns:
the default Token to represent this node if none was saved. Uses the one given in the InitialToken configuration directive, or picks one automatically if that was not given.

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


Copyright © 2009 The Apache Software Foundation