Cell (apache-cassandra API)
Date: 2018-02-14

org.apache.cassandra.db.rows

## Class Cell

- java.lang.Object
- - org.apache.cassandra.db.rows.ColumnData
  - - org.apache.cassandra.db.rows.Cell

- Direct Known Subclasses:
    AbstractCell

      public abstract class Cell
      extends ColumnData

  A cell is our atomic unit for a single value of a single column.

  A cell always holds at least a timestamp that gives us how the cell reconcile. We then have 3 main types of cells: 1) live regular cells: those will also have a value and, if for a complex column, a path. 2) expiring cells: on top of regular cells, those have a ttl and a local deletion time (when they are expired). 3) tombstone cells: those won't have value, but they have a local deletion time (when the tombstone was created).

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.util.Comparator<Cell>` | `comparator`
    `static int` | `MAX_DELETION_TIME`
    `static int` | `NO_DELETION_TIME`
    `static int` | `NO_TTL`
    `static org.apache.cassandra.db.rows.Cell.Serializer` | `serializer`

    - ### Fields inherited from class org.apache.cassandra.db.rows.ColumnData

      `column`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Cell(ColumnDefinition column)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract Cell` | `copy(AbstractAllocator allocator)`
    `abstract boolean` | `isCounterCell()` Whether the cell is a counter cell or not.
    `abstract boolean` | `isExpiring()` Whether the cell is an expiring one or not.
    `abstract boolean` | `isLive(int nowInSec)` Whether the cell is live or not given the current time.
    `abstract boolean` | `isTombstone()` Whether the cell is a tombstone or not.
    `abstract int` | `localDeletionTime()` The cell local deletion time.
    `abstract Cell` | `markCounterLocalToBeCleared()`
    `abstract CellPath` | `path()` For cells belonging to complex types (non-frozen collection and UDT), the path to the cell.
    `abstract Cell` | `purge(DeletionPurger purger, int nowInSec)`
    `abstract long` | `timestamp()` The cell timestamp.
    `abstract int` | `ttl()` The cell ttl.
    `abstract java.nio.ByteBuffer` | `value()` The cell value.
    `abstract Cell` | `withUpdatedColumn(ColumnDefinition newColumn)`
    `abstract Cell` | `withUpdatedTimestampAndLocalDeletionTime(long newTimestamp, int newLocalDeletionTime)`
    `abstract Cell` | `withUpdatedValue(java.nio.ByteBuffer newValue)`

    - ### Methods inherited from class org.apache.cassandra.db.rows.ColumnData

      `column, dataSize, digest, maxTimestamp, unsharedHeapSizeExcludingData, updateAllTimestamp, validate`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### NO_TTL

          public static final int NO_TTL

      See Also:
        Constant Field Values

    - #### NO_DELETION_TIME

          public static final int NO_DELETION_TIME

      See Also:
        Constant Field Values

    - #### MAX_DELETION_TIME

          public static final int MAX_DELETION_TIME

      See Also:
        Constant Field Values

    - #### comparator

          public static final java.util.Comparator<Cell> comparator

    - #### serializer

          public static final org.apache.cassandra.db.rows.Cell.Serializer serializer

  - ### Constructor Detail

    - #### Cell

          protected Cell(ColumnDefinition column)

  - ### Method Detail

    - #### isCounterCell

          public abstract boolean isCounterCell()

      Whether the cell is a counter cell or not.
      Returns:
        whether the cell is a counter cell or not.

    - #### value

          public abstract java.nio.ByteBuffer value()

      The cell value.
      Returns:
        the cell value.

    - #### timestamp

          public abstract long timestamp()

      The cell timestamp.

      Returns:
        the cell timestamp.

    - #### ttl

          public abstract int ttl()

      The cell ttl.
      Returns:
        the cell ttl, or `NO_TTL` if the cell isn't an expiring one.

    - #### localDeletionTime

          public abstract int localDeletionTime()

      The cell local deletion time.
      Returns:
        the cell local deletion time, or `NO_DELETION_TIME` if the cell is neither a tombstone nor an expiring one.

    - #### isTombstone

          public abstract boolean isTombstone()

      Whether the cell is a tombstone or not.
      Returns:
        whether the cell is a tombstone or not.

    - #### isExpiring

          public abstract boolean isExpiring()

      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 `isLive(int)` for that latter information.

      Returns:
        whether the cell is an expiring one or not.

    - #### isLive

          public abstract boolean isLive(int nowInSec)

      Whether the cell is live or not given the current time.
      Parameters:
        `nowInSec` - the current time in seconds. This is used to decide if an expiring cell is expired or live.
      Returns:
        whether the cell is live or not at `nowInSec`.

    - #### path

          public abstract CellPath path()

      For cells belonging to complex types (non-frozen collection and UDT), the path to the cell.
      Returns:
        the cell path for cells of complex column, and `null` for other cells.

    - #### withUpdatedColumn

          public abstract Cell withUpdatedColumn(ColumnDefinition newColumn)

    - #### withUpdatedValue

          public abstract Cell withUpdatedValue(java.nio.ByteBuffer newValue)

    - #### withUpdatedTimestampAndLocalDeletionTime

          public abstract Cell withUpdatedTimestampAndLocalDeletionTime(long newTimestamp,
                                                                        int newLocalDeletionTime)

    - #### copy

          public abstract Cell copy(AbstractAllocator allocator)

    - #### markCounterLocalToBeCleared

          public abstract Cell markCounterLocalToBeCleared()

      Specified by:
        `markCounterLocalToBeCleared` in class `ColumnData`

    - #### purge

          public abstract Cell purge(DeletionPurger purger,
                                     int nowInSec)

      Specified by:
        `purge` in class `ColumnData`

Copyright © 2018 The Apache Software Foundation