|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.cassandra.db.AtomicSortedColumns
public class AtomicSortedColumns
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.DeletionInfo, ISortedColumns.Factory |
| Field Summary | |
|---|---|
static ISortedColumns.Factory |
factory
|
| Method Summary | |
|---|---|
void |
addAll(ISortedColumns cm,
Allocator allocator,
com.google.common.base.Function<IColumn,IColumn> transformation)
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(ISortedColumns.DeletionInfo info)
|
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()
|
ISortedColumns.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(java.nio.ByteBuffer start)
Returns an iterator over the columns of this map starting from the first column whose name is equal or greater than @param start. |
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()
Returns an iterator that iterates over the columns of this map in reverse order. |
java.util.Iterator<IColumn> |
reverseIterator(java.nio.ByteBuffer start)
Returns a reversed iterator over the columns of this map starting from the last column whose name is equal or lesser than @param start. |
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 |
|---|
public static final ISortedColumns.Factory factory
| Method Detail |
|---|
public static ISortedColumns.Factory factory()
public AbstractType<?> getComparator()
getComparator in interface IIterableColumnspublic ISortedColumns.Factory getFactory()
ISortedColumns
getFactory in interface ISortedColumnspublic ISortedColumns cloneMe()
ISortedColumns
cloneMe in interface ISortedColumnspublic ISortedColumns.DeletionInfo getDeletionInfo()
getDeletionInfo in interface ISortedColumnspublic void delete(ISortedColumns.DeletionInfo info)
delete in interface ISortedColumnspublic void maybeResetDeletionTimes(int gcBefore)
maybeResetDeletionTimes in interface ISortedColumnspublic void retainAll(ISortedColumns columns)
retainAll in interface ISortedColumns
public void addColumn(IColumn column,
Allocator allocator)
ISortedColumns
addColumn in interface ISortedColumns
public void addAll(ISortedColumns cm,
Allocator allocator,
com.google.common.base.Function<IColumn,IColumn> transformation)
ISortedColumns
for (Column c : cm)
add(c);
but is potentially faster.
addAll in interface ISortedColumns
public boolean replace(IColumn oldColumn,
IColumn newColumn)
ISortedColumns
replace in interface ISortedColumnspublic void removeColumn(java.nio.ByteBuffer name)
ISortedColumns
removeColumn in interface ISortedColumnspublic void clear()
ISortedColumns
clear in interface ISortedColumnspublic IColumn getColumn(java.nio.ByteBuffer name)
ISortedColumns
getColumn in interface ISortedColumnspublic java.util.SortedSet<java.nio.ByteBuffer> getColumnNames()
ISortedColumns
getColumnNames in interface ISortedColumnspublic java.util.Collection<IColumn> getSortedColumns()
ISortedColumns
getSortedColumns in interface ISortedColumnspublic java.util.Collection<IColumn> getReverseSortedColumns()
ISortedColumns
getReverseSortedColumns in interface ISortedColumnspublic int size()
ISortedColumns
size in interface ISortedColumnspublic int getEstimatedColumnCount()
getEstimatedColumnCount in interface IIterableColumnspublic boolean isEmpty()
ISortedColumns
isEmpty in interface ISortedColumnspublic java.util.Iterator<IColumn> iterator()
iterator in interface java.lang.Iterable<IColumn>public java.util.Iterator<IColumn> reverseIterator()
ISortedColumns
reverseIterator in interface ISortedColumnspublic java.util.Iterator<IColumn> iterator(java.nio.ByteBuffer start)
ISortedColumns
iterator in interface ISortedColumnspublic java.util.Iterator<IColumn> reverseIterator(java.nio.ByteBuffer start)
ISortedColumns
reverseIterator in interface ISortedColumnspublic boolean isInsertReversed()
ISortedColumns
isInsertReversed in interface ISortedColumns
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||