Interface PrimaryKey
-
- All Superinterfaces:
ByteComparable
,java.lang.Comparable<PrimaryKey>
public interface PrimaryKey extends java.lang.Comparable<PrimaryKey>, ByteComparable
Representation of the primary key for a row consisting of theDecoratedKey
andClustering
associated with aRow
. ThePrimaryKey.Factory.TokenOnlyPrimaryKey
is used by theStorageAttachedIndexSearcher
to position the search within the query range.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
PrimaryKey.Factory
static class
PrimaryKey.Kind
See the javadoc forkind()
for how this enum is used.-
Nested classes/interfaces inherited from interface org.apache.cassandra.utils.bytecomparable.ByteComparable
ByteComparable.Version
-
-
Field Summary
-
Fields inherited from interface org.apache.cassandra.utils.bytecomparable.ByteComparable
EMPTY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ByteSource
asComparableBytes(ByteComparable.Version version)
Returns thePrimaryKey
as aByteSource
byte comparable representation.Clustering<?>
clustering()
Returns theClustering
representing the clustering component of thePrimaryKey
.default int
compareToStrict(PrimaryKey o)
PrimaryKey.Kind
kind()
Returns thePrimaryKey.Kind
of thePrimaryKey
.DecoratedKey
partitionKey()
Returns theDecoratedKey
representing the partition key of thePrimaryKey
.Token
token()
Returns theToken
component of thePrimaryKey
default PrimaryKey
toStatic()
-
Methods inherited from interface org.apache.cassandra.utils.bytecomparable.ByteComparable
byteComparableAsString
-
-
-
-
Method Detail
-
kind
PrimaryKey.Kind kind()
Returns thePrimaryKey.Kind
of thePrimaryKey
. ThePrimaryKey.Kind
is used locally in theComparable.compareTo(Object)
methods to determine how far the comparision needs to go between keys.The
PrimaryKey.Kind
values have a categorization ofisClustering
. This indicates whether the key belongs to a table with clustering tables or not.
-
token
Token token()
Returns theToken
component of thePrimaryKey
-
partitionKey
DecoratedKey partitionKey()
Returns theDecoratedKey
representing the partition key of thePrimaryKey
.Note: This cannot be null but some
PrimaryKey
implementations can throwUnsupportedOperationException
if they do not support partition keys.
-
clustering
Clustering<?> clustering()
Returns theClustering
representing the clustering component of thePrimaryKey
.Note: This cannot be null but some
PrimaryKey
implementations can throwUnsupportedOperationException
if they do not support clustering columns.
-
asComparableBytes
ByteSource asComparableBytes(ByteComparable.Version version)
Returns thePrimaryKey
as aByteSource
byte comparable representation.It is important that these representations are only ever used with byte comparables using the same elements. This means that
asComparableBytes
responses can only be used together from the samePrimaryKey
implementation.- Specified by:
asComparableBytes
in interfaceByteComparable
- Parameters:
version
- theByteComparable.Version
to use for the implementation- Returns:
- the
ByteSource
byte comparable. - Throws:
java.lang.UnsupportedOperationException
- forPrimaryKey
implementations that are not byte-comparable
-
toStatic
default PrimaryKey toStatic()
-
compareToStrict
default int compareToStrict(PrimaryKey o)
-
-