org.apache.cassandra.db
Class DecoratedKey<T extends Token>
java.lang.Object
org.apache.cassandra.db.DecoratedKey<T>
- All Implemented Interfaces:
- java.lang.Comparable<DecoratedKey>
public class DecoratedKey<T extends Token>
- extends java.lang.Object
- implements java.lang.Comparable<DecoratedKey>
Represents a decorated key, handy for certain operations
where just working with strings gets slow.
We do a lot of sorting of DecoratedKeys, so for speed, we assume that tokens correspond one-to-one with keys.
This is not quite correct in the case of RandomPartitioner (which uses MD5 to hash keys to tokens);
if this matters, you can subclass RP to use a stronger hash, or use a non-lossy tokenization scheme (as in the
OrderPreservingPartitioner classes).
Constructor Summary |
DecoratedKey(T token,
java.nio.ByteBuffer key)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
comparator
public static final java.util.Comparator<DecoratedKey> comparator
token
public final T extends Token token
key
public final java.nio.ByteBuffer key
DecoratedKey
public DecoratedKey(T token,
java.nio.ByteBuffer key)
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object
compareTo
public int compareTo(DecoratedKey other)
- Specified by:
compareTo
in interface java.lang.Comparable<DecoratedKey>
isEmpty
public boolean isEmpty()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2011 The Apache Software Foundation