org.apache.cassandra.db

## Class AtomicSortedColumns

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

- All Implemented Interfaces:
    java.lang.Iterable<IColumn>, ISortedColumns, IIterableColumns

      public class AtomicSortedColumns
      extends java.lang.Object
      implements ISortedColumns

  A thread-safe and atomic ISortedColumns implementation. Operations (in particular addAll) on this implemenation are atomic and isolated (in the sense of ACID). Typically a addAll is guaranteed that no other thread can see the state where only parts but not all columns have been added. The implementation uses snaptree (https://github.com/nbronson/snaptree), and in particular it's copy-on-write clone operation to achieve its atomicity guarantee. WARNING: removing element through getSortedColumns().iterator() is *not* isolated of other operations and could actually be fully ignored in the face of a concurrent. Don't use it unless in a non-concurrent context. TODO: check the snaptree license make it ok to use

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.cassandra.db.ISortedColumns

      `ISortedColumns.Factory`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static ISortedColumns.Factory` | `factory`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAll(ISortedColumns cm, Allocator allocator, com.google.common.base.Function<IColumn,IColumn> transformation)` Adds the columns without necessarily computing the size delta
    `long` | `addAllWithSizeDelta(ISortedColumns cm, Allocator allocator, com.google.common.base.Function<IColumn,IColumn> transformation, SecondaryIndexManager.Updater indexer)` Adds all the columns of a given column map to this column map.
    `void` | `addColumn(IColumn column, Allocator allocator)` Adds a column to this column map.
    `void` | `clear()` Clear this column map, removing all columns.
    `ISortedColumns` | `cloneMe()` Shallow cloning of the column map.
    `void` | `delete(DeletionInfo info)`
    `void` | `delete(RangeTombstone tombstone)`
    `static ISortedColumns.Factory` | `factory()`
    `IColumn` | `getColumn(java.nio.ByteBuffer name)` Get a column given its name, returning null if the column is not present.
    `java.util.SortedSet<java.nio.ByteBuffer>` | `getColumnNames()` Returns a set with the names of columns in this column map.
    `AbstractType<?>` | `getComparator()`
    `DeletionInfo` | `getDeletionInfo()`
    `int` | `getEstimatedColumnCount()`
    `ISortedColumns.Factory` | `getFactory()` Returns the factory used for this ISortedColumns implementation.
    `java.util.Collection<IColumn>` | `getReverseSortedColumns()` Returns the columns of this column map as a collection.
    `java.util.Collection<IColumn>` | `getSortedColumns()` Returns the columns of this column map as a collection.
    `boolean` | `isEmpty()` Returns true if this map is empty, false otherwise.
    `boolean` | `isInsertReversed()` Returns if this map only support inserts in reverse order.
    `java.util.Iterator<IColumn>` | `iterator()`
    `java.util.Iterator<IColumn>` | `iterator(ColumnSlice[] slices)` Returns an iterator over the columns of this map that returns only the matching @param slices.
    `void` | `maybeResetDeletionTimes(int gcBefore)`
    `void` | `removeColumn(java.nio.ByteBuffer name)` Remove if present a column by name.
    `boolean` | `replace(IColumn oldColumn, IColumn newColumn)` Replace oldColumn if present by newColumn.
    `void` | `retainAll(ISortedColumns columns)`
    `java.util.Iterator<IColumn>` | `reverseIterator(ColumnSlice[] slices)` Returns a reversed iterator over the columns of this map that returns only the matching @param slices.
    `void` | `setDeletionInfo(DeletionInfo newInfo)`
    `int` | `size()` Returns the number of columns in this map.

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

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

- - ### Field Detail

    - #### factory

          public static final ISortedColumns.Factory factory

  - ### Method Detail

    - #### factory

          public static ISortedColumns.Factory factory()

    - #### getComparator

          public AbstractType<?> getComparator()

      Specified by:
        `getComparator` in interface `IIterableColumns`

    - #### getFactory

          public ISortedColumns.Factory getFactory()

      Description copied from interface: `ISortedColumns`
      Returns the factory used for this ISortedColumns implementation.
      Specified by:
        `getFactory` in interface `ISortedColumns`

    - #### cloneMe

          public ISortedColumns cloneMe()

      Description copied from interface: `ISortedColumns`
      Shallow cloning of the column map.
      Specified by:
        `cloneMe` in interface `ISortedColumns`

    - #### getDeletionInfo

          public DeletionInfo getDeletionInfo()

      Specified by:
        `getDeletionInfo` in interface `ISortedColumns`

    - #### delete

          public void delete(RangeTombstone tombstone)

      Specified by:
        `delete` in interface `ISortedColumns`

    - #### delete

          public void delete(DeletionInfo info)

      Specified by:
        `delete` in interface `ISortedColumns`

    - #### setDeletionInfo

          public void setDeletionInfo(DeletionInfo newInfo)

      Specified by:
        `setDeletionInfo` in interface `ISortedColumns`

    - #### maybeResetDeletionTimes

          public void maybeResetDeletionTimes(int gcBefore)

      Specified by:
        `maybeResetDeletionTimes` in interface `ISortedColumns`

    - #### retainAll

          public void retainAll(ISortedColumns columns)

      Specified by:
        `retainAll` in interface `ISortedColumns`

    - #### addColumn

          public void addColumn(IColumn column,
                       Allocator allocator)

      Description copied from interface: `ISortedColumns`
      Adds a column to this column map. If a column with the same name is already present in the map, it will be replaced by the newly added column.
      Specified by:
        `addColumn` in interface `ISortedColumns`

    - #### addAll

          public void addAll(ISortedColumns cm,
                    Allocator allocator,
                    com.google.common.base.Function<IColumn,IColumn> transformation)

      Description copied from interface: `ISortedColumns`
      Adds the columns without necessarily computing the size delta
      Specified by:
        `addAll` in interface `ISortedColumns`

    - #### addAllWithSizeDelta

          public long addAllWithSizeDelta(ISortedColumns cm,
                                 Allocator allocator,
                                 com.google.common.base.Function<IColumn,IColumn> transformation,
                                 SecondaryIndexManager.Updater indexer)

      Description copied from interface: `ISortedColumns`
      Adds all the columns of a given column map to this column map. This is equivalent to: `for (Column c : cm) add(c);` but is potentially faster.
      Specified by:
        `addAllWithSizeDelta` in interface `ISortedColumns`
      Returns:
        the difference in size seen after merging the given columns

    - #### replace

          public boolean replace(IColumn oldColumn,
                        IColumn newColumn)

      Description copied from interface: `ISortedColumns`
      Replace oldColumn if present by newColumn. Returns true if oldColumn was present and thus replaced. oldColumn and newColumn should have the same name.
      Specified by:
        `replace` in interface `ISortedColumns`

    - #### removeColumn

          public void removeColumn(java.nio.ByteBuffer name)

      Description copied from interface: `ISortedColumns`
      Remove if present a column by name.
      Specified by:
        `removeColumn` in interface `ISortedColumns`

    - #### clear

          public void clear()

      Description copied from interface: `ISortedColumns`
      Clear this column map, removing all columns.
      Specified by:
        `clear` in interface `ISortedColumns`

    - #### getColumn

          public IColumn getColumn(java.nio.ByteBuffer name)

      Description copied from interface: `ISortedColumns`
      Get a column given its name, returning null if the column is not present.
      Specified by:
        `getColumn` in interface `ISortedColumns`

    - #### getColumnNames

          public java.util.SortedSet<java.nio.ByteBuffer> getColumnNames()

      Description copied from interface: `ISortedColumns`
      Returns a set with the names of columns in this column map. The resulting set is sorted and the order is the one of the columns in this column map.
      Specified by:
        `getColumnNames` in interface `ISortedColumns`

    - #### getSortedColumns

          public java.util.Collection<IColumn> getSortedColumns()

      Description copied from interface: `ISortedColumns`
      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.
      Specified by:
        `getSortedColumns` in interface `ISortedColumns`

    - #### getReverseSortedColumns

          public java.util.Collection<IColumn> getReverseSortedColumns()

      Description copied from interface: `ISortedColumns`
      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.
      Specified by:
        `getReverseSortedColumns` in interface `ISortedColumns`

    - #### size

          public int size()

      Description copied from interface: `ISortedColumns`
      Returns the number of columns in this map.
      Specified by:
        `size` in interface `ISortedColumns`

    - #### getEstimatedColumnCount

          public int getEstimatedColumnCount()

      Specified by:
        `getEstimatedColumnCount` in interface `IIterableColumns`

    - #### isEmpty

          public boolean isEmpty()

      Description copied from interface: `ISortedColumns`
      Returns true if this map is empty, false otherwise.
      Specified by:
        `isEmpty` in interface `ISortedColumns`

    - #### iterator

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

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

    - #### iterator

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

      Description copied from interface: `ISortedColumns`
      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.
      Specified by:
        `iterator` in interface `ISortedColumns`

    - #### reverseIterator

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

      Description copied from interface: `ISortedColumns`
      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.
      Specified by:
        `reverseIterator` in interface `ISortedColumns`

    - #### isInsertReversed

          public boolean isInsertReversed()

      Description copied from interface: `ISortedColumns`
      Returns if this map only support inserts in reverse order.
      Specified by:
        `isInsertReversed` in interface `ISortedColumns`

Copyright © 2014 The Apache Software Foundation