Package org.apache.cassandra.db
Class BufferDecoratedKey
- java.lang.Object
-
- org.apache.cassandra.db.DecoratedKey
-
- org.apache.cassandra.db.BufferDecoratedKey
-
- All Implemented Interfaces:
java.lang.Comparable<PartitionPosition>
,PartitionPosition
,RingPosition<PartitionPosition>
,ByteComparable
,IFilter.FilterKey
- Direct Known Subclasses:
CachedHashDecoratedKey
,PreHashedDecoratedKey
public class BufferDecoratedKey extends DecoratedKey
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.cassandra.utils.bytecomparable.ByteComparable
ByteComparable.Version
-
Nested classes/interfaces inherited from interface org.apache.cassandra.db.PartitionPosition
PartitionPosition.ForKey, PartitionPosition.Kind, PartitionPosition.RowPositionSerializer
-
-
Field Summary
-
Fields inherited from class org.apache.cassandra.db.DecoratedKey
comparator
-
Fields inherited from interface org.apache.cassandra.utils.bytecomparable.ByteComparable
EMPTY
-
Fields inherited from interface org.apache.cassandra.db.PartitionPosition
serializer
-
-
Constructor Summary
Constructors Constructor Description BufferDecoratedKey(Token token, java.nio.ByteBuffer key)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BufferDecoratedKey
fromByteComparable(ByteComparable byteComparable, ByteComparable.Version version, IPartitioner partitioner)
A factory method that translates the given byte-comparable representation to aBufferDecoratedKey
instance.java.nio.ByteBuffer
getKey()
int
getKeyLength()
-
Methods inherited from class org.apache.cassandra.db.DecoratedKey
asComparableBound, asComparableBytes, compareTo, compareTo, equals, filterHash, getPartitioner, getToken, hashCode, isMinimum, keyComparableBytes, keyFromByteSource, kind, minValue, retainable, toCQLString, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.utils.bytecomparable.ByteComparable
byteComparableAsString
-
Methods inherited from interface org.apache.cassandra.utils.IFilter.FilterKey
filterHashLowerBits
-
-
-
-
Constructor Detail
-
BufferDecoratedKey
public BufferDecoratedKey(Token token, java.nio.ByteBuffer key)
-
-
Method Detail
-
getKey
public java.nio.ByteBuffer getKey()
- Specified by:
getKey
in classDecoratedKey
-
getKeyLength
public int getKeyLength()
- Specified by:
getKeyLength
in classDecoratedKey
-
fromByteComparable
public static BufferDecoratedKey fromByteComparable(ByteComparable byteComparable, ByteComparable.Version version, IPartitioner partitioner)
A factory method that translates the given byte-comparable representation to aBufferDecoratedKey
instance. If the given byte comparable doesn't represent the encoding of a buffer decorated key, anything from a wide variety of throwables may be thrown (e.g.AssertionError
,IndexOutOfBoundsException
,IllegalStateException
, etc.).- Parameters:
byteComparable
- A byte-comparable representation (presumably of aBufferDecoratedKey
instance).version
- The encoding version used for the given byte comparable.partitioner
- The partitioner of the encoded decorated key. Needed in order to correctly decode the token bytes of the key.- Returns:
- A new
BufferDecoratedKey
instance, corresponding to the given byte-comparable representation. If we were to callDecoratedKey.asComparableBytes(Version)
on the returned object, we should get aByteSource
equal to the one of the input byte comparable.
-
-