org.apache.cassandra.db

## Class DeletionInfo

- java.lang.Object
- - org.apache.cassandra.db.DeletionInfo

All Implemented Interfaces:
  IMeasurableMemory

    public class DeletionInfo
    extends java.lang.Object
    implements IMeasurableMemory

A combination of a top-level (or row) tombstone and range tombstones describing the deletions within a `ColumnFamily` (or row).

### Nested Class Summary

Nested Classes
`class` `DeletionInfo.InOrderTester` This object allow testing whether a given column (name/timestamp) is deleted or not by this DeletionInfo, assuming that the columns given to this object are passed in forward or reversed comparator sorted order.
`static class` `DeletionInfo.Serializer`

### Constructor Summary

Constructors
Constructor and Description
`DeletionInfo(Composite start, Composite end, java.util.Comparator<Composite> comparator, long markedForDeleteAt, int localDeletionTime)`
`DeletionInfo(DeletionTime topLevel)`
`DeletionInfo(long markedForDeleteAt, int localDeletionTime)` Creates a DeletionInfo with only a top-level (row) tombstone.
`DeletionInfo(RangeTombstone rangeTombstone, java.util.Comparator<Composite> comparator)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`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, java.util.Comparator<Composite> comparator)`
`DeletionInfo` `copy()`
`DeletionInfo` `copy(AbstractAllocator allocator)`
`int` `dataSize()`
`DeletionInfo` `diff(DeletionInfo superset)` Evaluates difference between this deletion info and superset for read repair
`boolean` `equals(java.lang.Object o)`
`DeletionTime` `getTopLevelDeletion()` Returns the top-level (or "row") tombstone.
`int` `hashCode()`
`boolean` `hasPurgeableTombstones(int gcBefore)` Returns true if `purge` would remove the top-level tombstone or any of the range tombstones, false otherwise.
`boolean` `hasRanges()`
`DeletionInfo.InOrderTester` `inOrderTester()` Returns a new `DeletionInfo.InOrderTester` in forward order.
`DeletionInfo.InOrderTester` `inOrderTester(boolean reversed)` Returns a new `DeletionInfo.InOrderTester` given the order in which columns will be passed to it.
`boolean` `isDeleted(Cell cell)` Return whether a given cell is deleted by the container having this deletion info.
`boolean` `isLive()` Returns whether this DeletionInfo is live, that is deletes no columns.
`static DeletionInfo` `live()` Returns a new DeletionInfo that has no top-level tombstone or any range tombstones.
`long` `maxTimestamp()` Returns the maximum timestamp in any of the range tombstones or the top-level tombstone.
`boolean` `mayModify(DeletionInfo delInfo)` Whether this deletion info may modify the provided one if added to it.
`long` `minTimestamp()` Returns the minimum timestamp in any of the range tombstones or the top-level tombstone.
`void` `purge(int gcBefore)` Purge every tombstones that are older than `gcbefore`.
`int` `rangeCount()`
`RangeTombstone` `rangeCovering(Composite name)`
`java.util.Iterator<RangeTombstone>` `rangeIterator()`
`java.util.Iterator<RangeTombstone>` `rangeIterator(Composite start, Composite finish)`
`java.lang.String` `toString()`
`long` `unsharedHeapSize()`
`void` `updateAllTimestamp(long timestamp)`
`void` `updateDigest(java.security.MessageDigest digest)` Digests deletion info.

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### DeletionInfo

    public DeletionInfo(long markedForDeleteAt,
                        int localDeletionTime)

Creates a DeletionInfo with only a top-level (row) tombstone.

Parameters:
  `markedForDeleteAt` - the time after which the entire row should be considered deleted
  `localDeletionTime` - what time the deletion write was applied locally (for purposes of purging the tombstone after gc_grace_seconds).

#### DeletionInfo

    public DeletionInfo(DeletionTime topLevel)

#### DeletionInfo

    public DeletionInfo(Composite start,
                        Composite end,
                        java.util.Comparator<Composite> comparator,
                        long markedForDeleteAt,
                        int localDeletionTime)

#### DeletionInfo

    public DeletionInfo(RangeTombstone rangeTombstone,
                        java.util.Comparator<Composite> comparator)

### Method Detail

#### live

    public static DeletionInfo live()

Returns a new DeletionInfo that has no top-level tombstone or any range tombstones.

#### copy

    public DeletionInfo copy()

#### copy

    public DeletionInfo copy(AbstractAllocator allocator)

#### isLive

    public boolean isLive()

Returns whether this DeletionInfo is live, that is deletes no columns.

#### isDeleted

    public boolean isDeleted(Cell cell)

Return whether a given cell is deleted by the container having this deletion info.

Parameters:
  `cell` - the cell to check.
Returns:
  true if the cell is deleted, false otherwise

#### inOrderTester

    public DeletionInfo.InOrderTester inOrderTester()

Returns a new `DeletionInfo.InOrderTester` in forward order.

#### inOrderTester

    public DeletionInfo.InOrderTester inOrderTester(boolean reversed)

Returns a new `DeletionInfo.InOrderTester` given the order in which columns will be passed to it.

#### purge

    public void purge(int gcBefore)

Purge every tombstones that are older than `gcbefore`.

Parameters:
  `gcBefore` - timestamp (in seconds) before which tombstones should be purged

#### diff

    public DeletionInfo diff(DeletionInfo superset)

Evaluates difference between this deletion info and superset for read repair

Returns:
  the difference between the two, or LIVE if no difference

#### updateDigest

    public void updateDigest(java.security.MessageDigest digest)

Digests deletion info. Used to trigger read repair on mismatch.

#### hasPurgeableTombstones

    public boolean hasPurgeableTombstones(int gcBefore)

Returns true if `purge` would remove the top-level tombstone or any of the range tombstones, false otherwise.

Parameters:
  `gcBefore` - timestamp (in seconds) before which tombstones should be purged

#### add

    public void add(DeletionTime newInfo)

Potentially replaces the top-level tombstone with another, keeping whichever has the higher markedForDeleteAt timestamp.

Parameters:
  `newInfo` -

#### add

    public void add(RangeTombstone tombstone,
                    java.util.Comparator<Composite> 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.

#### minTimestamp

    public long minTimestamp()

Returns the minimum timestamp in any of the range tombstones or the top-level tombstone.

#### maxTimestamp

    public long maxTimestamp()

Returns the maximum timestamp in any of the range tombstones or the top-level tombstone.

#### getTopLevelDeletion

    public DeletionTime getTopLevelDeletion()

Returns the top-level (or "row") tombstone.

#### rangeIterator

    public java.util.Iterator<RangeTombstone> rangeIterator()

#### rangeIterator

    public java.util.Iterator<RangeTombstone> rangeIterator(Composite start,
                                                            Composite finish)

#### rangeCovering

    public RangeTombstone rangeCovering(Composite name)

#### dataSize

    public int dataSize()

#### hasRanges

    public boolean hasRanges()

#### rangeCount

    public int rangeCount()

#### mayModify

    public boolean mayModify(DeletionInfo delInfo)

Whether this deletion info may modify the provided one if added to it.

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### updateAllTimestamp

    public void updateAllTimestamp(long timestamp)

#### equals

    public boolean equals(java.lang.Object o)

Overrides:
  `equals` in class `java.lang.Object`

#### hashCode

    public final int hashCode()

Overrides:
  `hashCode` in class `java.lang.Object`

#### unsharedHeapSize

    public long unsharedHeapSize()

Specified by:
  `unsharedHeapSize` in interface `IMeasurableMemory`
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.