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

public interface ClusteringPrefix<V> extends IMeasurableMemory, Clusterable<V>
A clustering prefix is the unit of what a 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.

  • Field Details

  • Method Details

    • isBottom

      default boolean isBottom()
    • isTop

      default boolean isTop()
    • 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

      V get(int i)
      Retrieves the ith value of this prefix.
      Parameters:
      i - the index of the value to retrieve. Must be such that 0 <= i < size().
      Returns:
      the ith value of this prefix. Note that a value can be null.
    • accessor

      ValueAccessor<V> accessor()
    • bufferAt

      default ByteBuffer bufferAt(int i)
    • stringAt

      default String stringAt(int i, ClusteringComparator comparator)
    • validate

      default void validate()
    • validate

      default void validate(int i, ClusteringComparator comparator)
    • digest

      default void digest(Digest 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

      String toString(TableMetadata metadata)
      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

      default ByteBuffer serializeAsPartitionKey()
    • clusteringString

      default String clusteringString(List<AbstractType<?>> types)
      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() and get(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

      static <V> int hashCode(ClusteringPrefix<V> prefix)
    • equals

      static <V1, V2> boolean equals(ClusteringPrefix<V1> left, ClusteringPrefix<V2> right)
    • equals

      static boolean equals(ClusteringPrefix<?> prefix, Object o)