Package org.apache.cassandra.dht
Class Token.KeyBound
- java.lang.Object
-
- org.apache.cassandra.dht.Token.KeyBound
-
- All Implemented Interfaces:
java.lang.Comparable<PartitionPosition>
,PartitionPosition
,RingPosition<PartitionPosition>
,ByteComparable
- Enclosing class:
- Token
public static class Token.KeyBound extends java.lang.Object implements PartitionPosition
-
-
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 Modifier and Type Field Description boolean
isMinimumBound
-
Fields inherited from interface org.apache.cassandra.utils.bytecomparable.ByteComparable
EMPTY
-
Fields inherited from interface org.apache.cassandra.db.PartitionPosition
serializer
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteComparable
asComparableBound(boolean before)
Produce a byte-comparable representation for the position before or after the key.ByteSource
asComparableBytes(ByteComparable.Version version)
Produce a prefix-free byte-comparable representation of the key, i.e.int
compareTo(PartitionPosition pos)
boolean
equals(java.lang.Object obj)
IPartitioner
getPartitioner()
Token
getToken()
int
hashCode()
boolean
isMinimum()
PartitionPosition.Kind
kind()
Token.KeyBound
minValue()
java.lang.String
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
-
-
-
-
Method Detail
-
getToken
public Token getToken()
- Specified by:
getToken
in interfaceRingPosition<PartitionPosition>
-
compareTo
public int compareTo(PartitionPosition pos)
- Specified by:
compareTo
in interfacejava.lang.Comparable<PartitionPosition>
-
asComparableBytes
public ByteSource asComparableBytes(ByteComparable.Version version)
Description copied from interface:PartitionPosition
Produce a prefix-free byte-comparable representation of the key, i.e. such a sequence of bytes that any pair x, y of valid positions (with the same key column types and partitioner), x.compareTo(y) == compareLexicographicallyUnsigned(x.asComparableBytes(), y.asComparableBytes()) and x.asComparableBytes() is not a prefix of y.asComparableBytes() We use a two-component tuple for decorated keys, and a one-component tuple for key bounds, where the terminator byte is chosen to yield the correct comparison result. No decorated key can be a prefix of another (per the tuple encoding), and no key bound can be a prefix of one because it uses a terminator byte that is different from the tuple separator.- Specified by:
asComparableBytes
in interfaceByteComparable
- Specified by:
asComparableBytes
in interfacePartitionPosition
-
asComparableBound
public ByteComparable asComparableBound(boolean before)
Description copied from interface:PartitionPosition
Produce a byte-comparable representation for the position before or after the key. This does nothing for token boundaries (which are already at a position between valid keys), and changes the terminator byte for keys.- Specified by:
asComparableBound
in interfacePartitionPosition
-
getPartitioner
public IPartitioner getPartitioner()
- Specified by:
getPartitioner
in interfaceRingPosition<PartitionPosition>
-
minValue
public Token.KeyBound minValue()
- Specified by:
minValue
in interfaceRingPosition<PartitionPosition>
-
isMinimum
public boolean isMinimum()
- Specified by:
isMinimum
in interfacePartitionPosition
- Specified by:
isMinimum
in interfaceRingPosition<PartitionPosition>
-
kind
public PartitionPosition.Kind kind()
- Specified by:
kind
in interfacePartitionPosition
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-