Interface ClusteringPrefix<V>
- All Superinterfaces:
Clusterable<V>,IMeasurableMemory
- All Known Subinterfaces:
Clustering<V>,ClusteringBound<V>,ClusteringBoundary<V>,ClusteringBoundOrBoundary<V>
- All Known Implementing Classes:
AbstractArrayClusteringPrefix,AbstractBufferClusteringPrefix,AbstractOnHeapClusteringPrefix,ArrayClustering,ArrayClusteringBound,ArrayClusteringBoundary,ArrayClusteringBoundOrBoundary,BufferClustering,BufferClusteringBound,BufferClusteringBoundary,BufferClusteringBoundOrBoundary,NativeClustering
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.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classHelper class that makes the deserialization of clustering prefixes faster.static enumThe kind of clustering prefix this actually is.static class -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionaccessor()Returns this prefix as an end bound.Returns this prefix as a start bound.default ByteBufferbufferAt(int i) default StringclusteringString(List<AbstractType<?>> types) Produce a human-readable representation of the clustering given the list of types.default intdataSize()The size of the data hold by this prefix.default voidAdds the data of this clustering prefix to the provided Digest instance.static booleanequals(ClusteringPrefix<?> prefix, Object o) static <V1,V2> boolean equals(ClusteringPrefix<V1> left, ClusteringPrefix<V2> right) get(int i) Retrieves the ith value of this prefix.V[]The values of this prefix as an array.static <V> inthashCode(ClusteringPrefix<V> prefix) default booleanisBottom()default booleanisEmpty()default booleanisTop()kind()Return the key in a form that can be retained for longer-term use.default ByteBufferintsize()The number of values in this prefix.default StringstringAt(int i, ClusteringComparator comparator) toString(TableMetadata metadata) Generates a proper string representation of the prefix.default voidvalidate()default voidvalidate(int i, ClusteringComparator comparator) Methods inherited from interface org.apache.cassandra.db.Clusterable
clusteringMethods inherited from interface org.apache.cassandra.cache.IMeasurableMemory
unsharedHeapSize
-
Field Details
-
serializer
-
-
Method Details
-
isBottom
default boolean isBottom() -
isTop
default boolean isTop() -
kind
ClusteringPrefix.Kind kind() -
size
int size()The number of values in this prefix. There can't be more values that the this is a prefix of has of clustering columns.- Returns:
- the number of values in this prefix.
-
isEmpty
default boolean isEmpty() -
get
Retrieves the ith value of this prefix.- Parameters:
i- the index of the value to retrieve. Must be such that0 <= i < size().- Returns:
- the ith value of this prefix. Note that a value can be
null.
-
accessor
ValueAccessor<V> accessor() -
bufferAt
-
stringAt
-
validate
default void validate() -
validate
-
digest
Adds the data of this clustering prefix to the provided Digest instance.- Parameters:
digest- the Digest instance to which to add this prefix.
-
dataSize
default int dataSize()The size of the data hold by this prefix.- Returns:
- the size of the data hold by this prefix (this is not the size of the object in memory, just the size of the data it stores).
-
toString
Generates a proper string representation of the prefix.- Parameters:
metadata- the metadata for the table the clustering prefix is of.- Returns:
- a human-readable string representation fo this prefix.
-
asStartBound
ClusteringBound<V> asStartBound()Returns this prefix as a start bound. If this prefix is a bound, just returns it asserting that it is a start bound. If this prefix is a clustering, returns an included start bound. If this prefix is a boundary, returns an open bound of it -
asEndBound
ClusteringBound<V> asEndBound()Returns this prefix as an end bound. If this prefix is a bound, just returns it asserting that it is an end bound. If this prefix is a clustering, returns an included end bound. In this prefix is a boundary, returns a close bound of it. -
serializeAsPartitionKey
-
clusteringString
Produce a human-readable representation of the clustering given the list of types. Easier to access than metadata for debugging. -
getRawValues
V[] getRawValues()The values of this prefix as an array.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()andget(int)unless you actually need an array.- Returns:
- the values for this prefix as an array.
-
getBufferArray
ByteBuffer[] getBufferArray() -
retainable
ClusteringPrefix<V> retainable()Return the key in a form that can be retained for longer-term use. This means extracting keys stored in shared memory (i.e. in memtables) to minimized on-heap versions. If the object is already in minimal form, no action will be taken. -
hashCode
-
equals
-
equals
-