public interface ClusteringPrefix<V> extends IMeasurableMemory, Clusterable<V>
ClusteringComparator
can compare.
It holds values for the clustering columns of a table (potentially only a prefix of all of them) and has a "kind" that allows us to implement slices with inclusive and exclusive bounds.
In practice, ClusteringPrefix
is just the common parts to its 3 main subtype: Clustering
and
ClusteringBound
/ClusteringBoundary
, where:
1) Clustering
represents the clustering values for a row, i.e. the values for it's clustering columns.
2) ClusteringBound
represents a bound (start or end) of a slice (of rows) or a range tombstone.
3) ClusteringBoundary
represents the threshold between two adjacent range tombstones.
See those classes for more details.
Modifier and Type | Interface and Description |
---|---|
static class |
ClusteringPrefix.Deserializer
Helper class that makes the deserialization of clustering prefixes faster.
|
static class |
ClusteringPrefix.Kind
The kind of clustering prefix this actually is.
|
static class |
ClusteringPrefix.Serializer |
Modifier and Type | Field and Description |
---|---|
static ClusteringPrefix.Serializer |
serializer |
Modifier and Type | Method and Description |
---|---|
ValueAccessor<V> |
accessor() |
default java.nio.ByteBuffer |
bufferAt(int i) |
default int |
dataSize()
The size of the data hold by this prefix.
|
default void |
digest(Digest digest)
Adds the data of this clustering prefix to the provided Digest instance.
|
static boolean |
equals(ClusteringPrefix<?> prefix,
java.lang.Object o) |
static <V1,V2> boolean |
equals(ClusteringPrefix<V1> left,
ClusteringPrefix<V2> right) |
V |
get(int i)
Retrieves the ith value of this prefix.
|
java.nio.ByteBuffer[] |
getBufferArray() |
V[] |
getRawValues()
The values of this prefix as an array.
|
static <V> int |
hashCode(ClusteringPrefix<V> prefix) |
default boolean |
isBottom() |
default boolean |
isEmpty() |
default boolean |
isTop() |
ClusteringPrefix.Kind |
kind() |
ClusteringPrefix<V> |
minimize()
If the prefix contains byte buffers that can be minimized (see
ByteBufferUtil.minimalBufferFor(ByteBuffer) ),
this will return a copy of the prefix with minimized values, otherwise it returns itself. |
default java.nio.ByteBuffer |
serializeAsPartitionKey() |
int |
size()
The number of values in this prefix.
|
default java.lang.String |
stringAt(int i,
ClusteringComparator comparator) |
java.lang.String |
toString(TableMetadata metadata)
Generates a proper string representation of the prefix.
|
default void |
validate(int i,
ClusteringComparator comparator) |
unsharedHeapSize
clustering
static final ClusteringPrefix.Serializer serializer
default boolean isBottom()
default boolean isTop()
ClusteringPrefix.Kind kind()
int size()
default boolean isEmpty()
V get(int i)
i
- the index of the value to retrieve. Must be such that 0 <= i < size()
.null
.ValueAccessor<V> accessor()
default java.nio.ByteBuffer bufferAt(int i)
default java.lang.String stringAt(int i, ClusteringComparator comparator)
default void validate(int i, ClusteringComparator comparator)
default void digest(Digest digest)
digest
- the Digest instance to which to add this prefix.default int dataSize()
java.lang.String toString(TableMetadata metadata)
metadata
- the metadata for the table the clustering prefix is of.default java.nio.ByteBuffer serializeAsPartitionKey()
V[] getRawValues()
Please note that this may or may not require an array creation. So 1) you should *not*
modify the returned array and 2) it's more efficient to use size()
and
get(int)
unless you actually need an array.
java.nio.ByteBuffer[] getBufferArray()
ClusteringPrefix<V> minimize()
ByteBufferUtil.minimalBufferFor(ByteBuffer)
),
this will return a copy of the prefix with minimized values, otherwise it returns itself.static <V> int hashCode(ClusteringPrefix<V> prefix)
static <V1,V2> boolean equals(ClusteringPrefix<V1> left, ClusteringPrefix<V2> right)
static boolean equals(ClusteringPrefix<?> prefix, java.lang.Object o)
Copyright © 2009- The Apache Software Foundation