org.apache.cassandra.db.partitions

## Class CachedBTreePartition

- java.lang.Object
- - org.apache.cassandra.db.partitions.AbstractBTreePartition
  - - org.apache.cassandra.db.partitions.ImmutableBTreePartition
    - - org.apache.cassandra.db.partitions.CachedBTreePartition

- All Implemented Interfaces:
    java.lang.Iterable<Row>, IRowCacheEntry, CachedPartition, Partition

      public class CachedBTreePartition
      extends ImmutableBTreePartition
      implements CachedPartition

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.cassandra.db.partitions.AbstractBTreePartition

      `AbstractBTreePartition.Holder, AbstractBTreePartition.SlicesIterator`

  - ### Field Summary

    - ### Fields inherited from class org.apache.cassandra.db.partitions.ImmutableBTreePartition

      `holder`

    - ### Fields inherited from class org.apache.cassandra.db.partitions.AbstractBTreePartition

      `EMPTY, metadata, partitionKey`

    - ### Fields inherited from interface org.apache.cassandra.db.partitions.CachedPartition

      `cacheSerializer`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `cachedLiveRows()` The number of rows that were live at the time the partition was cached.
    `static CachedBTreePartition` | `create(UnfilteredRowIterator iterator, int nowInSec)` Creates an `ArrayBackedCachedPartition` holding all the data of the provided iterator.
    `static CachedBTreePartition` | `create(UnfilteredRowIterator iterator, int initialRowCapacity, int nowInSec)` Creates an `ArrayBackedCachedPartition` holding all the data of the provided iterator.
    `int` | `nonExpiringLiveCells()` The number of cells in this cached partition that are neither tombstone nor expiring.
    `int` | `nonTombstoneCellCount()` The number of `cell` objects that are not tombstone in this cached partition.
    `int` | `rowsWithNonExpiringCells()` The number of rows in this cached partition that have at least one non-expiring non-deleted cell.

    - ### Methods inherited from class org.apache.cassandra.db.partitions.ImmutableBTreePartition

      `canHaveShadowedData, create, create, create, holder`

    - ### Methods inherited from class org.apache.cassandra.db.partitions.AbstractBTreePartition

      `build, build, build, columns, deletionInfo, getRow, hasRows, isEmpty, iterator, lastRow, metadata, partitionKey, partitionLevelDeletion, rowCount, searchIterator, staticRow, stats, toString, unfilteredIterator, unfilteredIterator, unfilteredIterator`

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

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

    - ### Methods inherited from interface org.apache.cassandra.db.partitions.CachedPartition

      `lastRow, rowCount`

    - ### Methods inherited from interface org.apache.cassandra.db.partitions.Partition

      `columns, getRow, isEmpty, metadata, partitionKey, partitionLevelDeletion, searchIterator, stats, unfilteredIterator, unfilteredIterator`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Method Detail

    - #### create

          public static CachedBTreePartition create(UnfilteredRowIterator iterator,
                                                    int nowInSec)

      Creates an `ArrayBackedCachedPartition` holding all the data of the provided iterator. Warning: Note that this method does not close the provided iterator and it is up to the caller to do so.
      Parameters:
        `iterator` - the iterator got gather in memory.
        `nowInSec` - the time of the creation in seconds. This is the time at which `cachedLiveRows` applies.
      Returns:
        the created partition.

    - #### create

          public static CachedBTreePartition create(UnfilteredRowIterator iterator,
                                                    int initialRowCapacity,
                                                    int nowInSec)

      Creates an `ArrayBackedCachedPartition` holding all the data of the provided iterator. Warning: Note that this method does not close the provided iterator and it is up to the caller to do so.
      Parameters:
        `iterator` - the iterator got gather in memory.
        `initialRowCapacity` - sizing hint (in rows) to use for the created partition. It should ideally correspond or be a good estimation of the number or rows in `iterator`.
        `nowInSec` - the time of the creation in seconds. This is the time at which `cachedLiveRows` applies.
      Returns:
        the created partition.

    - #### cachedLiveRows

          public int cachedLiveRows()

      The number of rows that were live at the time the partition was cached. See `ColumnFamilyStore.isFilterFullyCoveredBy(org.apache.cassandra.db.filter.ClusteringIndexFilter, org.apache.cassandra.db.filter.DataLimits, org.apache.cassandra.db.partitions.CachedPartition, int)` to see why we need this.
      Specified by:
        `cachedLiveRows` in interface `CachedPartition`
      Returns:
        the number of rows in this partition that were live at the time the partition was cached (this can be different from the number of live rows now due to expiring cells).

    - #### rowsWithNonExpiringCells

          public int rowsWithNonExpiringCells()

      The number of rows in this cached partition that have at least one non-expiring non-deleted cell. Note that this is generally not a very meaningful number, but this is used by `DataLimits.hasEnoughLiveData(org.apache.cassandra.db.partitions.CachedPartition, int, boolean, boolean)` as an optimization.
      Specified by:
        `rowsWithNonExpiringCells` in interface `CachedPartition`
      Returns:
        the number of row that have at least one non-expiring non-deleted cell.

    - #### nonTombstoneCellCount

          public int nonTombstoneCellCount()

      Description copied from interface: `CachedPartition`
      The number of `cell` objects that are not tombstone in this cached partition. Please note that this is not the number of live cells since some of the cells might be expired.
      Specified by:
        `nonTombstoneCellCount` in interface `CachedPartition`
      Returns:
        the number of non tombstone cells in the partition.

    - #### nonExpiringLiveCells

          public int nonExpiringLiveCells()

      Description copied from interface: `CachedPartition`
      The number of cells in this cached partition that are neither tombstone nor expiring. Note that this is generally not a very meaningful number, but this is used by `DataLimits.hasEnoughLiveData(org.apache.cassandra.db.partitions.CachedPartition, int, boolean, boolean)` as an optimization.
      Specified by:
        `nonExpiringLiveCells` in interface `CachedPartition`
      Returns:
        the number of cells that are neither tombstones nor expiring.

Copyright © 2018 The Apache Software Foundation