ColumnFamily (apache-cassandra API)
Date: 2014-10-21

org.apache.cassandra.db

## Class ColumnFamily

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

- All Implemented Interfaces:
    java.lang.Iterable<Cell>, IRowCacheEntry
  Direct Known Subclasses:
    ArrayBackedSortedColumns, AtomicBTreeColumns

      public abstract class ColumnFamily
      extends java.lang.Object
      implements java.lang.Iterable<Cell>, IRowCacheEntry

  A sorted map of columns. This represents the backing map of a colum family. Whether the implementation is thread safe or not is left to the implementing classes.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ColumnFamily.Factory<T extends ColumnFamily>`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected CFMetaData` | `metadata`
    `static ColumnFamilySerializer` | `serializer`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ColumnFamily(CFMetaData metadata)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `addAll(ColumnFamily cm)` Adds all the columns of a given column map to this column map.
    `void` | `addAtom(OnDiskAtom atom)`
    `abstract void` | `addColumn(Cell cell)` Adds a cell to this cell map.
    `void` | `addColumn(CellName name, java.nio.ByteBuffer value, long timestamp)`
    `void` | `addColumn(CellName name, java.nio.ByteBuffer value, long timestamp, int timeToLive)`
    `void` | `addCounter(CellName name, long value)`
    `void` | `addTombstone(CellName name, java.nio.ByteBuffer localDeletionTime, long timestamp)`
    `void` | `addTombstone(CellName name, int localDeletionTime, long timestamp)`
    `java.util.Map<CellName,java.nio.ByteBuffer>` | `asMap()`
    `abstract void` | `clear()` Clear this column family, removing all columns and deletion info.
    `abstract ColumnFamily` | `cloneMe()` Clones the column map.
    `ColumnFamily` | `cloneMeShallow()`
    `<T extends ColumnFamily> T` | `cloneMeShallow(ColumnFamily.Factory<T> factory, boolean reversedInsertOrder)`
    `long` | `dataSize()`
    `void` | `delete(ColumnFamily columns)` If `columns` has any tombstones (top-level or range tombstones), they will be applied to this set of columns.
    `abstract void` | `delete(DeletionInfo info)`
    `abstract void` | `delete(DeletionTime deletionTime)`
    `protected abstract void` | `delete(RangeTombstone tombstone)`
    `abstract DeletionInfo` | `deletionInfo()`
    `ColumnFamily` | `diff(ColumnFamily cfComposite)`
    `static ColumnFamily` | `diff(ColumnFamily cf1, ColumnFamily cf2)`
    `static java.nio.ByteBuffer` | `digest(ColumnFamily cf)`
    `boolean` | `equals(java.lang.Object o)`
    `static ColumnFamily` | `fromBytes(java.nio.ByteBuffer bytes)`
    `abstract Cell` | `getColumn(CellName name)` Get a column given its name, returning null if the column is not present.
    `abstract int` | `getColumnCount()` Returns the number of columns in this map.
    `abstract java.lang.Iterable<CellName>` | `getColumnNames()` Returns an iterable with the names of columns in this column map in the same order as the underlying columns themselves.
    `ColumnStats` | `getColumnStats()`
    `CellNameType` | `getComparator()`
    `abstract ColumnFamily.Factory` | `getFactory()` Returns the factory used for this ISortedColumns implementation.
    `abstract java.util.Collection<Cell>` | `getReverseSortedColumns()` Returns the columns of this column map as a collection.
    `abstract java.util.Collection<Cell>` | `getSortedColumns()` Returns the columns of this column map as a collection.
    `ColumnFamilyType` | `getType()`
    `abstract boolean` | `hasColumns()` Returns whether or not there are any columns present.
    `int` | `hashCode()`
    `boolean` | `hasOnlyTombstones(long now)`
    `java.util.UUID` | `id()`
    `DeletionInfo.InOrderTester` | `inOrderDeletionTester()` Returns a `DeletionInfo.InOrderTester` for the deletionInfo() of this column family.
    `boolean` | `isEmpty()` Returns true if this contains no columns or deletion info
    `abstract boolean` | `isInsertReversed()` Returns if this map only support inserts in reverse order.
    `boolean` | `isMarkedForDelete()`
    `java.util.Iterator<Cell>` | `iterator()`
    `abstract java.util.Iterator<Cell>` | `iterator(ColumnSlice[] slices)` Returns an iterator over the columns of this map that returns only the matching @param slices.
    `int` | `liveCQL3RowCount(long now)`
    `long` | `maxTimestamp()`
    `abstract void` | `maybeAppendColumn(Cell cell, DeletionInfo.InOrderTester tester, int gcBefore)` Adds a cell if it's non-gc-able and isn't shadowed by a partition/range tombstone with a higher timestamp.
    `CFMetaData` | `metadata()`
    `abstract void` | `purgeTombstones(int gcBefore)` Purges top-level and range tombstones whose localDeletionTime is older than gcBefore.
    `java.util.Iterator<Cell>` | `reverseIterator()`
    `abstract java.util.Iterator<Cell>` | `reverseIterator(ColumnSlice[] slices)` Returns a reversed iterator over the columns of this map that returns only the matching @param slices.
    `abstract void` | `setDeletionInfo(DeletionInfo info)`
    `java.nio.ByteBuffer` | `toBytes()`
    `java.lang.String` | `toString()`
    `void` | `updateDigest(java.security.MessageDigest digest)`

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

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

- - ### Field Detail

    - #### serializer

          public static final ColumnFamilySerializer serializer

    - #### metadata

          protected final CFMetaData metadata

  - ### Constructor Detail

    - #### ColumnFamily

          protected ColumnFamily(CFMetaData metadata)

  - ### Method Detail

    - #### cloneMeShallow

          public <T extends ColumnFamily> T cloneMeShallow(ColumnFamily.Factory<T> factory,
                                                  boolean reversedInsertOrder)

    - #### cloneMeShallow

          public ColumnFamily cloneMeShallow()

    - #### getType

          public ColumnFamilyType getType()

    - #### liveCQL3RowCount

          public int liveCQL3RowCount(long now)

    - #### cloneMe

          public abstract ColumnFamily cloneMe()

      Clones the column map.

    - #### id

          public java.util.UUID id()

    - #### metadata

          public CFMetaData metadata()

      Returns:
        The CFMetaData for this row

    - #### addColumn

          public void addColumn(CellName name,
                       java.nio.ByteBuffer value,
                       long timestamp)

    - #### addColumn

          public void addColumn(CellName name,
                       java.nio.ByteBuffer value,
                       long timestamp,
                       int timeToLive)

    - #### addCounter

          public void addCounter(CellName name,
                        long value)

    - #### addTombstone

          public void addTombstone(CellName name,
                          java.nio.ByteBuffer localDeletionTime,
                          long timestamp)

    - #### addTombstone

          public void addTombstone(CellName name,
                          int localDeletionTime,
                          long timestamp)

    - #### addAtom

          public void addAtom(OnDiskAtom atom)

    - #### clear

          public abstract void clear()

      Clear this column family, removing all columns and deletion info.

    - #### inOrderDeletionTester

          public DeletionInfo.InOrderTester inOrderDeletionTester()

      Returns a `DeletionInfo.InOrderTester` for the deletionInfo() of this column family. Please note that for ThreadSafe implementation of ColumnFamily, this tester will remain valid even if new tombstones are added to this ColumnFamily *as long as said addition is done in comparator order*. For AtomicSortedColumns, the tester will correspond to the state of when this method is called.

    - #### getFactory

          public abstract ColumnFamily.Factory getFactory()

      Returns the factory used for this ISortedColumns implementation.

    - #### deletionInfo

          public abstract DeletionInfo deletionInfo()

    - #### setDeletionInfo

          public abstract void setDeletionInfo(DeletionInfo info)

    - #### delete

          public abstract void delete(DeletionInfo info)

    - #### delete

          public abstract void delete(DeletionTime deletionTime)

    - #### delete

          protected abstract void delete(RangeTombstone tombstone)

    - #### purgeTombstones

          public abstract void purgeTombstones(int gcBefore)

      Purges top-level and range tombstones whose localDeletionTime is older than gcBefore.
      Parameters:
        `gcBefore` - a timestamp (in seconds) before which tombstones should be purged

    - #### addColumn

          public abstract void addColumn(Cell cell)

      Adds a cell to this cell map. If a cell with the same name is already present in the map, it will be replaced by the newly added cell.

    - #### maybeAppendColumn

          public abstract void maybeAppendColumn(Cell cell,
                               DeletionInfo.InOrderTester tester,
                               int gcBefore)

      Adds a cell if it's non-gc-able and isn't shadowed by a partition/range tombstone with a higher timestamp. Requires that the cell to add is sorted strictly after the last cell in the container.

    - #### addAll

          public abstract void addAll(ColumnFamily cm)

      Adds all the columns of a given column map to this column map. This is equivalent to: `for (Cell c : cm) addColumn(c, ...);` but is potentially faster.

    - #### getColumn

          public abstract Cell getColumn(CellName name)

      Get a column given its name, returning null if the column is not present.

    - #### getColumnNames

          public abstract java.lang.Iterable<CellName> getColumnNames()

      Returns an iterable with the names of columns in this column map in the same order as the underlying columns themselves.

    - #### getSortedColumns

          public abstract java.util.Collection<Cell> getSortedColumns()

      Returns the columns of this column map as a collection. The columns in the returned collection should be sorted as the columns in this map.

    - #### getReverseSortedColumns

          public abstract java.util.Collection<Cell> getReverseSortedColumns()

      Returns the columns of this column map as a collection. The columns in the returned collection should be sorted in reverse order of the columns in this map.

    - #### getColumnCount

          public abstract int getColumnCount()

      Returns the number of columns in this map.

    - #### hasColumns

          public abstract boolean hasColumns()

      Returns whether or not there are any columns present.

    - #### isEmpty

          public boolean isEmpty()

      Returns true if this contains no columns or deletion info

    - #### iterator

          public abstract java.util.Iterator<Cell> iterator(ColumnSlice[] slices)

      Returns an iterator over the columns of this map that returns only the matching @param slices. The provided slices must be in order and must be non-overlapping.

    - #### reverseIterator

          public abstract java.util.Iterator<Cell> reverseIterator(ColumnSlice[] slices)

      Returns a reversed iterator over the columns of this map that returns only the matching @param slices. The provided slices must be in reversed order and must be non-overlapping.

    - #### isInsertReversed

          public abstract boolean isInsertReversed()

      Returns if this map only support inserts in reverse order.

    - #### delete

          public void delete(ColumnFamily columns)

      If `columns` has any tombstones (top-level or range tombstones), they will be applied to this set of columns.

    - #### diff

          public ColumnFamily diff(ColumnFamily cfComposite)

    - #### dataSize

          public long dataSize()

    - #### maxTimestamp

          public long maxTimestamp()

    - #### hashCode

          public int hashCode()

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

    - #### equals

          public boolean equals(java.lang.Object o)

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

    - #### toString

          public java.lang.String toString()

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

    - #### digest

          public static java.nio.ByteBuffer digest(ColumnFamily cf)

    - #### updateDigest

          public void updateDigest(java.security.MessageDigest digest)

    - #### diff

          public static ColumnFamily diff(ColumnFamily cf1,
                          ColumnFamily cf2)

    - #### getColumnStats

          public ColumnStats getColumnStats()

    - #### isMarkedForDelete

          public boolean isMarkedForDelete()

    - #### getComparator

          public CellNameType getComparator()

      Returns:
        the comparator whose sorting order the contained columns conform to

    - #### hasOnlyTombstones

          public boolean hasOnlyTombstones(long now)

    - #### iterator

          public java.util.Iterator<Cell> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<Cell>`

    - #### reverseIterator

          public java.util.Iterator<Cell> reverseIterator()

    - #### asMap

          public java.util.Map<CellName,java.nio.ByteBuffer> asMap()

    - #### fromBytes

          public static ColumnFamily fromBytes(java.nio.ByteBuffer bytes)

    - #### toBytes

          public java.nio.ByteBuffer toBytes()

Copyright © 2014 The Apache Software Foundation