Package org.apache.cassandra.db
Class MutableDeletionInfo
- java.lang.Object
-
- org.apache.cassandra.db.MutableDeletionInfo
-
- All Implemented Interfaces:
IMeasurableMemory
,DeletionInfo
public class MutableDeletionInfo extends java.lang.Object implements DeletionInfo
A mutable implementation ofDeletionInfo
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MutableDeletionInfo.Builder
Builds DeletionInfo object from (in order) range tombstone markers.
-
Field Summary
-
Fields inherited from interface org.apache.cassandra.db.DeletionInfo
LIVE
-
-
Constructor Summary
Constructors Constructor Description MutableDeletionInfo(long markedForDeleteAt, long localDeletionTime)
Creates a DeletionInfo with only a top-level (row) tombstone.MutableDeletionInfo(DeletionTime partitionDeletion)
MutableDeletionInfo(DeletionTime partitionDeletion, RangeTombstoneList ranges)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DeletionInfo
add(DeletionInfo newInfo)
Combines another DeletionInfo with this one and returns the result.void
add(DeletionTime newInfo)
Potentially replaces the top-level tombstone with another, keeping whichever has the higher markedForDeleteAt timestamp.void
add(RangeTombstone tombstone, ClusteringComparator comparator)
static MutableDeletionInfo.Builder
builder(DeletionTime partitionLevelDeletion, ClusteringComparator comparator, boolean reversed)
MutableDeletionInfo
clone(ByteBufferCloner cloner)
void
collectStats(EncodingStats.Collector collector)
int
dataSize()
boolean
equals(java.lang.Object o)
DeletionTime
getPartitionDeletion()
int
hashCode()
boolean
hasRanges()
boolean
isLive()
Returns whether this DeletionInfo is live, that is deletes no columns.static MutableDeletionInfo
live()
Returns a new DeletionInfo that has no top-level tombstone or any range tombstones.long
maxTimestamp()
boolean
mayModify(DeletionInfo delInfo)
Whether this deletion info may modify the provided one if added to it.MutableDeletionInfo
mutableCopy()
int
rangeCount()
RangeTombstone
rangeCovering(Clustering<?> name)
java.util.Iterator<RangeTombstone>
rangeIterator(boolean reversed)
java.util.Iterator<RangeTombstone>
rangeIterator(Slice slice, boolean reversed)
java.lang.String
toString()
long
unsharedHeapSize()
DeletionInfo
updateAllTimestamp(long timestamp)
-
-
-
Constructor Detail
-
MutableDeletionInfo
public MutableDeletionInfo(long markedForDeleteAt, long localDeletionTime)
Creates a DeletionInfo with only a top-level (row) tombstone.- Parameters:
markedForDeleteAt
- the time after which the entire row should be considered deletedlocalDeletionTime
- what time the deletion write was applied locally (for purposes of purging the tombstone after gc_grace_seconds).
-
MutableDeletionInfo
public MutableDeletionInfo(DeletionTime partitionDeletion)
-
MutableDeletionInfo
public MutableDeletionInfo(DeletionTime partitionDeletion, RangeTombstoneList ranges)
-
-
Method Detail
-
live
public static MutableDeletionInfo live()
Returns a new DeletionInfo that has no top-level tombstone or any range tombstones.
-
mutableCopy
public MutableDeletionInfo mutableCopy()
- Specified by:
mutableCopy
in interfaceDeletionInfo
-
clone
public MutableDeletionInfo clone(ByteBufferCloner cloner)
- Specified by:
clone
in interfaceDeletionInfo
-
isLive
public boolean isLive()
Returns whether this DeletionInfo is live, that is deletes no columns.- Specified by:
isLive
in interfaceDeletionInfo
-
add
public void add(DeletionTime newInfo)
Potentially replaces the top-level tombstone with another, keeping whichever has the higher markedForDeleteAt timestamp.- Parameters:
newInfo
- the deletion time to add to this deletion info.
-
add
public void add(RangeTombstone tombstone, ClusteringComparator comparator)
-
add
public DeletionInfo add(DeletionInfo newInfo)
Combines another DeletionInfo with this one and returns the result. Whichever top-level tombstone has the higher markedForDeleteAt timestamp will be kept, along with its localDeletionTime. The range tombstones will be combined.- Returns:
- this object.
-
getPartitionDeletion
public DeletionTime getPartitionDeletion()
- Specified by:
getPartitionDeletion
in interfaceDeletionInfo
-
rangeIterator
public java.util.Iterator<RangeTombstone> rangeIterator(boolean reversed)
- Specified by:
rangeIterator
in interfaceDeletionInfo
-
rangeIterator
public java.util.Iterator<RangeTombstone> rangeIterator(Slice slice, boolean reversed)
- Specified by:
rangeIterator
in interfaceDeletionInfo
-
rangeCovering
public RangeTombstone rangeCovering(Clustering<?> name)
- Specified by:
rangeCovering
in interfaceDeletionInfo
-
dataSize
public int dataSize()
- Specified by:
dataSize
in interfaceDeletionInfo
-
hasRanges
public boolean hasRanges()
- Specified by:
hasRanges
in interfaceDeletionInfo
-
rangeCount
public int rangeCount()
- Specified by:
rangeCount
in interfaceDeletionInfo
-
maxTimestamp
public long maxTimestamp()
- Specified by:
maxTimestamp
in interfaceDeletionInfo
-
mayModify
public boolean mayModify(DeletionInfo delInfo)
Whether this deletion info may modify the provided one if added to it.- Specified by:
mayModify
in interfaceDeletionInfo
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
updateAllTimestamp
public DeletionInfo updateAllTimestamp(long timestamp)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public final int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
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.
-
collectStats
public void collectStats(EncodingStats.Collector collector)
- Specified by:
collectStats
in interfaceDeletionInfo
-
builder
public static MutableDeletionInfo.Builder builder(DeletionTime partitionLevelDeletion, ClusteringComparator comparator, boolean reversed)
-
-