Interface ByteComparable
- All Known Subinterfaces:
PartitionPosition,PrimaryKey
- All Known Implementing Classes:
BufferDecoratedKey,CachedHashDecoratedKey,DecoratedKey,NativeDecoratedKey,PreHashedDecoratedKey,Token.KeyBound
public interface ByteComparable
Interface indicating a value can be represented/identified by a comparable
ByteSource.
All Cassandra types that can be used as part of a primary key have a corresponding byte-comparable translation,
detailed in ByteComparable.md. Byte-comparable representations are used in some memtable as well as primary and
secondary index implementations.-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionasComparableBytes(ByteComparable.Version version) Returns a source that generates the byte-comparable representation of the value byte by byte.default StringConstruct a human-readable string from the byte-comparable representation.static intcompare(ByteComparable bytes1, ByteComparable bytes2, ByteComparable.Version version) Compare two byte-comparable values by their byte-comparable representation.static ByteComparablecut(ByteComparable src, int cutoff) static intdiffPoint(ByteComparable bytes1, ByteComparable bytes2, ByteComparable.Version version) Returns the length of the minimum prefix that differentiates the two given byte-comparable representations.static ByteComparablefixedLength(byte[] bytes) static ByteComparablefixedLength(byte[] bytes, int offset, int len) static ByteComparablefixedLength(ByteBuffer bytes) static intlength(ByteComparable src, ByteComparable.Version version) Return the length of a byte comparable, not including the terminator byte.static ByteComparableof(int value) static ByteComparableof(long value) static ByteComparablestatic ByteComparableseparatorGt(ByteComparable prevMax, ByteComparable currMin) Returns a separator for two byte comparable, i.e.static ByteComparableseparatorPrefix(ByteComparable prevMax, ByteComparable currMin) Returns a separator for two byte sources, i.e.
-
Field Details
-
EMPTY
-
-
Method Details
-
asComparableBytes
Returns a source that generates the byte-comparable representation of the value byte by byte. -
byteComparableAsString
Construct a human-readable string from the byte-comparable representation. Used for debugging. -
of
-
of
-
of
-
fixedLength
-
fixedLength
-
fixedLength
-
separatorPrefix
Returns a separator for two byte sources, i.e. something that is definitely > prevMax, and <= currMin, assuming prevMax < currMin. This returns the shortest prefix of currMin that is greater than prevMax. -
separatorGt
Returns a separator for two byte comparable, i.e. something that is definitely > prevMax, and <= currMin, assuming prevMax < currMin. This is a stream of length 1 longer than the common prefix of the two streams, with last byte one higher than the prevMax stream. -
cut
-
length
Return the length of a byte comparable, not including the terminator byte. -
compare
Compare two byte-comparable values by their byte-comparable representation. Used for tests.- Returns:
- the result of the lexicographic unsigned byte comparison of the byte-comparable representations of the two arguments
-
diffPoint
Returns the length of the minimum prefix that differentiates the two given byte-comparable representations.
-