Package org.apache.cassandra.db
Class NativeClustering
- java.lang.Object
-
- org.apache.cassandra.db.NativeClustering
-
- All Implemented Interfaces:
IMeasurableMemory
,Clusterable<java.nio.ByteBuffer>
,Clustering<java.nio.ByteBuffer>
,ClusteringPrefix<java.nio.ByteBuffer>
public class NativeClustering extends java.lang.Object implements Clustering<java.nio.ByteBuffer>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.cassandra.db.Clustering
Clustering.Serializer
-
Nested classes/interfaces inherited from interface org.apache.cassandra.db.ClusteringPrefix
ClusteringPrefix.Deserializer, ClusteringPrefix.Kind
-
-
Field Summary
-
Fields inherited from interface org.apache.cassandra.db.Clustering
EMPTY, serializer, STATIC_CLUSTERING
-
-
Constructor Summary
Constructors Constructor Description NativeClustering(NativeAllocator allocator, OpOrder.Group writeOp, Clustering<?> clustering)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ValueAccessor<java.nio.ByteBuffer>
accessor()
ClusteringPrefix<java.nio.ByteBuffer>
clustering()
boolean
equals(java.lang.Object o)
java.nio.ByteBuffer
get(int i)
Retrieves the ith value of this prefix.java.nio.ByteBuffer[]
getBufferArray()
java.nio.ByteBuffer[]
getRawValues()
The values of this prefix as an array.int
hashCode()
ClusteringPrefix.Kind
kind()
ClusteringPrefix<java.nio.ByteBuffer>
retainable()
Return the key in a form that can be retained for longer-term use.int
size()
The number of values in this prefix.long
unsharedHeapSize()
long
unsharedHeapSizeExcludingData()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.db.Clustering
asEndBound, asStartBound, clone, toCQLString, toString
-
Methods inherited from interface org.apache.cassandra.db.ClusteringPrefix
bufferAt, clusteringString, dataSize, digest, isBottom, isEmpty, isTop, serializeAsPartitionKey, stringAt, validate, validate
-
-
-
-
Constructor Detail
-
NativeClustering
public NativeClustering(NativeAllocator allocator, OpOrder.Group writeOp, Clustering<?> clustering)
-
-
Method Detail
-
kind
public ClusteringPrefix.Kind kind()
- Specified by:
kind
in interfaceClusteringPrefix<java.nio.ByteBuffer>
-
clustering
public ClusteringPrefix<java.nio.ByteBuffer> clustering()
- Specified by:
clustering
in interfaceClusterable<java.nio.ByteBuffer>
-
size
public int size()
Description copied from interface:ClusteringPrefix
The number of values in this prefix. There can't be more values that the this is a prefix of has of clustering columns.- Specified by:
size
in interfaceClusteringPrefix<java.nio.ByteBuffer>
- Returns:
- the number of values in this prefix.
-
get
public java.nio.ByteBuffer get(int i)
Description copied from interface:ClusteringPrefix
Retrieves the ith value of this prefix.- Specified by:
get
in interfaceClusteringPrefix<java.nio.ByteBuffer>
- 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
.
-
getRawValues
public java.nio.ByteBuffer[] getRawValues()
Description copied from interface:ClusteringPrefix
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
ClusteringPrefix.size()
andClusteringPrefix.get(int)
unless you actually need an array.- Specified by:
getRawValues
in interfaceClusteringPrefix<java.nio.ByteBuffer>
- Returns:
- the values for this prefix as an array.
-
getBufferArray
public java.nio.ByteBuffer[] getBufferArray()
- Specified by:
getBufferArray
in interfaceClusteringPrefix<java.nio.ByteBuffer>
-
accessor
public ValueAccessor<java.nio.ByteBuffer> accessor()
- Specified by:
accessor
in interfaceClusteringPrefix<java.nio.ByteBuffer>
-
unsharedHeapSize
public long unsharedHeapSize()
- Specified by:
unsharedHeapSize
in interfaceIMeasurableMemory
- Returns:
- the amount of on-heap memory retained by the object that might be reclaimed if the object were reclaimed, i.e. it should try to exclude globally cached data where possible, or counting portions of arrays that are referenced by the object but used by other objects only (e.g. slabbed byte-buffers), etc.
-
unsharedHeapSizeExcludingData
public long unsharedHeapSizeExcludingData()
- Specified by:
unsharedHeapSizeExcludingData
in interfaceClustering<java.nio.ByteBuffer>
-
hashCode
public final int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public final boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
retainable
public ClusteringPrefix<java.nio.ByteBuffer> retainable()
Description copied from interface:ClusteringPrefix
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.- Specified by:
retainable
in interfaceClusteringPrefix<java.nio.ByteBuffer>
-
-