org.apache.cassandra.db

## Interface ClusteringPrefix

All Superinterfaces:
  Clusterable, IMeasurableMemory

All Known Subinterfaces:
  Clustering

All Known Implementing Classes:
  AbstractBufferClusteringPrefix, AbstractClusteringPrefix, BufferClustering, ClusteringBound, ClusteringBoundary, ClusteringBoundOrBoundary, NativeClustering

    public interface ClusteringPrefix
    extends IMeasurableMemory, Clusterable

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.

### Nested Class Summary

Nested Classes
`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`

### Field Summary

Fields
`static ClusteringPrefix.Serializer` `serializer`

### Method Summary

All Methods Instance Methods Abstract Methods
`int` `dataSize()` The size of the data hold by this prefix.
`void` `digest(java.security.MessageDigest digest)` Adds the data of this clustering prefix to the provided digest.
`java.nio.ByteBuffer` `get(int i)` Retrieves the ith value of this prefix.
`java.nio.ByteBuffer[]` `getRawValues()` The values of this prefix as an array.
`ClusteringPrefix.Kind` `kind()`
`int` `size()` The number of values in this prefix.
`java.lang.String` `toString(CFMetaData metadata)` Generates a proper string representation of the prefix.

### Methods inherited from interface org.apache.cassandra.cache.IMeasurableMemory

`unsharedHeapSize`

### Methods inherited from interface org.apache.cassandra.db.Clusterable

`clustering`

### Field Detail

#### serializer

    static final ClusteringPrefix.Serializer serializer

### Method Detail

#### 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.

#### get

    java.nio.ByteBuffer 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`.

#### digest

    void digest(java.security.MessageDigest digest)

Adds the data of this clustering prefix to the provided digest.

Parameters:
  `digest` - the digest to which to add this prefix.

#### dataSize

    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

    java.lang.String toString(CFMetaData 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.

#### getRawValues

    java.nio.ByteBuffer[] 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.