Package org.apache.cassandra.db.rows
Class ColumnData
- java.lang.Object
-
- org.apache.cassandra.db.rows.ColumnData
-
- All Implemented Interfaces:
IMeasurableMemory
- Direct Known Subclasses:
Cell
,ComplexColumnData
public abstract class ColumnData extends java.lang.Object implements IMeasurableMemory
Generic interface for the data of a given column (inside a row). In practice, there is only 2 implementations of this: eitherCell
for simple columns orComplexColumnData
for complex columns.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ColumnData.PostReconciliationFunction
static class
ColumnData.Reconciler
-
Field Summary
Fields Modifier and Type Field Description protected ColumnMetadata
column
static java.util.Comparator<ColumnData>
comparator
static ColumnData.PostReconciliationFunction
noOp
-
Constructor Summary
Constructors Modifier Constructor Description protected
ColumnData(ColumnMetadata column)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract ColumnData
clone(Cloner cloner)
ColumnMetadata
column()
The column this is data for.abstract int
dataSize()
The size of the data hold by thisColumnData
.abstract void
digest(Digest digest)
Adds the data to the provided digest.static void
digest(Digest digest, ColumnData cd)
abstract boolean
hasInvalidDeletions()
Validates the deletions (ttl and local deletion time) if any.abstract ColumnData
markCounterLocalToBeCleared()
abstract long
maxTimestamp()
abstract ColumnData
purge(DeletionPurger purger, long nowInSec)
abstract ColumnData
purgeDataOlderThan(long timestamp)
static ColumnData.Reconciler
reconciler(ColumnData.PostReconciliationFunction updateF, DeletionTime activeDeletion)
Construct an UpdateFunction for reconciling normal ColumnData (i.e.abstract long
unsharedHeapSize()
abstract long
unsharedHeapSizeExcludingData()
abstract ColumnData
updateAllTimestamp(long newTimestamp)
Returns a copy of the data where all timestamps for live data have replaced bynewTimestamp
and all deletion timestamp bynewTimestamp - 1
.abstract void
validate()
Validate the column data.
-
-
-
Field Detail
-
comparator
public static final java.util.Comparator<ColumnData> comparator
-
noOp
public static ColumnData.PostReconciliationFunction noOp
-
column
protected final ColumnMetadata column
-
-
Constructor Detail
-
ColumnData
protected ColumnData(ColumnMetadata column)
-
-
Method Detail
-
reconciler
public static ColumnData.Reconciler reconciler(ColumnData.PostReconciliationFunction updateF, DeletionTime activeDeletion)
Construct an UpdateFunction for reconciling normal ColumnData (i.e. not suitable for ComplexColumnDeletion sentinels, but suitable ComplexColumnData or Cell)- Parameters:
updateF
- a consumer receiving all pairs of reconciled cellsactiveDeletion
- the row or partition deletion time to use for purging
-
column
public final ColumnMetadata column()
The column this is data for.- Returns:
- the column this is a data for.
-
dataSize
public abstract int dataSize()
The size of the data hold by thisColumnData
.- Returns:
- the size used by the data of this
ColumnData
.
-
unsharedHeapSizeExcludingData
public abstract long unsharedHeapSizeExcludingData()
-
unsharedHeapSize
public abstract 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.
-
validate
public abstract void validate()
Validate the column data.- Throws:
MarshalException
- if the data is not valid.
-
hasInvalidDeletions
public abstract boolean hasInvalidDeletions()
Validates the deletions (ttl and local deletion time) if any.- Returns:
- true if it has any invalid deletions, false otherwise
-
digest
public abstract void digest(Digest digest)
Adds the data to the provided digest.- Parameters:
digest
- theDigest
to add the data to.
-
digest
public static void digest(Digest digest, ColumnData cd)
-
clone
public abstract ColumnData clone(Cloner cloner)
-
updateAllTimestamp
public abstract ColumnData updateAllTimestamp(long newTimestamp)
Returns a copy of the data where all timestamps for live data have replaced bynewTimestamp
and all deletion timestamp bynewTimestamp - 1
. This exists for the Paxos path, seePartitionUpdate#updateAllTimestamp
for additional details.
-
markCounterLocalToBeCleared
public abstract ColumnData markCounterLocalToBeCleared()
-
purge
public abstract ColumnData purge(DeletionPurger purger, long nowInSec)
-
purgeDataOlderThan
public abstract ColumnData purgeDataOlderThan(long timestamp)
-
maxTimestamp
public abstract long maxTimestamp()
-
-