Package org.apache.cassandra.db.rows
Class AbstractCell<V>
- java.lang.Object
-
- org.apache.cassandra.db.rows.ColumnData
-
- org.apache.cassandra.db.rows.Cell<V>
-
- org.apache.cassandra.db.rows.AbstractCell<V>
-
- All Implemented Interfaces:
IMeasurableMemory
- Direct Known Subclasses:
ArrayCell
,BufferCell
,NativeCell
public abstract class AbstractCell<V> extends Cell<V>
Base abstract class forCell
implementations. Unless you have a very good reason not to, every cell implementation should probably extend this class.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.cassandra.db.rows.Cell
Cell.Factory<V>
-
Nested classes/interfaces inherited from class org.apache.cassandra.db.rows.ColumnData
ColumnData.PostReconciliationFunction, ColumnData.Reconciler
-
-
Field Summary
-
Fields inherited from class org.apache.cassandra.db.rows.Cell
comparator, INVALID_DELETION_TIME, MAX_DELETION_TIME, MAX_DELETION_TIME_2038_LEGACY_CAP, MAX_DELETION_TIME_UNSIGNED_INTEGER, NO_DELETION_TIME, NO_DELETION_TIME_UNSIGNED_INTEGER, NO_TTL, serializer
-
Fields inherited from class org.apache.cassandra.db.rows.ColumnData
column, noOp
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractCell(ColumnMetadata column)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Cell<?>
clone(ByteBufferCloner cloner)
int
dataSize()
The size of the data hold by thisColumnData
.void
digest(Digest digest)
Adds the data to the provided digest.boolean
equals(java.lang.Object other)
static <V1,V2>
booleanequals(Cell<V1> left, Cell<V2> right)
int
hashCode()
boolean
hasInvalidDeletions()
Validates the deletions (ttl and local deletion time) if any.boolean
isCounterCell()
Whether the cell is a counter cell or not.CassandraUIntboolean
isExpiring()
Whether the cell is an expiring one or not.boolean
isLive(long nowInSec)
Whether the cell is live or not given the current time.boolean
isTombstone()
Whether the cell is a tombstone or not.Cell<?>
markCounterLocalToBeCleared()
long
maxTimestamp()
Cell<?>
purge(DeletionPurger purger, long nowInSec)
Cell<?>
purgeDataOlderThan(long timestamp)
java.lang.String
toString()
Cell<?>
updateAllTimestamp(long newTimestamp)
Returns a copy of the data where all timestamps for live data have replaced bynewTimestamp
and all deletion timestamp bynewTimestamp - 1
.void
validate()
Validate the column data.-
Methods inherited from class org.apache.cassandra.db.rows.Cell
accessor, buffer, clone, decodeLocalDeletionTime, deletionTimeLongToUnsignedInteger, deletionTimeUnsignedIntegerToLong, getVersionedMaxDeletiontionTime, localDeletionTime, localDeletionTimeAsUnsignedInt, path, timestamp, ttl, value, valueSize, withSkippedValue, withUpdatedColumn, withUpdatedTimestampAndLocalDeletionTime, withUpdatedValue
-
Methods inherited from class org.apache.cassandra.db.rows.ColumnData
column, digest, reconciler, unsharedHeapSize, unsharedHeapSizeExcludingData
-
-
-
-
Constructor Detail
-
AbstractCell
protected AbstractCell(ColumnMetadata column)
-
-
Method Detail
-
isCounterCell
public boolean isCounterCell()
Description copied from class:Cell
Whether the cell is a counter cell or not.CassandraUInt- Specified by:
isCounterCell
in classCell<V>
- Returns:
- whether the cell is a counter cell or not.
-
isLive
public boolean isLive(long nowInSec)
Description copied from class:Cell
Whether the cell is live or not given the current time.
-
isTombstone
public boolean isTombstone()
Description copied from class:Cell
Whether the cell is a tombstone or not.- Specified by:
isTombstone
in classCell<V>
- Returns:
- whether the cell is a tombstone or not.
-
isExpiring
public boolean isExpiring()
Description copied from class:Cell
Whether the cell is an expiring one or not.Note that this only correspond to whether the cell liveness info have a TTL or not, but doesn't tells whether the cell is already expired or not. You should use
Cell.isLive(long)
for that latter information.- Specified by:
isExpiring
in classCell<V>
- Returns:
- whether the cell is an expiring one or not.
-
markCounterLocalToBeCleared
public Cell<?> markCounterLocalToBeCleared()
- Specified by:
markCounterLocalToBeCleared
in classCell<V>
-
purge
public Cell<?> purge(DeletionPurger purger, long nowInSec)
-
purgeDataOlderThan
public Cell<?> purgeDataOlderThan(long timestamp)
- Specified by:
purgeDataOlderThan
in classCell<V>
-
clone
public Cell<?> clone(ByteBufferCloner cloner)
-
updateAllTimestamp
public Cell<?> updateAllTimestamp(long newTimestamp)
Description copied from class:ColumnData
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.- Specified by:
updateAllTimestamp
in classColumnData
-
dataSize
public int dataSize()
Description copied from class:ColumnData
The size of the data hold by thisColumnData
.- Specified by:
dataSize
in classColumnData
- Returns:
- the size used by the data of this
ColumnData
.
-
digest
public void digest(Digest digest)
Description copied from class:ColumnData
Adds the data to the provided digest.- Specified by:
digest
in classColumnData
- Parameters:
digest
- theDigest
to add the data to.
-
validate
public void validate()
Description copied from class:ColumnData
Validate the column data.- Specified by:
validate
in classColumnData
-
hasInvalidDeletions
public boolean hasInvalidDeletions()
Description copied from class:ColumnData
Validates the deletions (ttl and local deletion time) if any.- Specified by:
hasInvalidDeletions
in classColumnData
- Returns:
- true if it has any invalid deletions, false otherwise
-
maxTimestamp
public long maxTimestamp()
- Specified by:
maxTimestamp
in classColumnData
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-