Class View
- java.lang.Object
-
- org.apache.cassandra.db.lifecycle.View
-
public class View extends java.lang.Object
An immutable structure holding the current memtable, the memtables pending flush, the sstables for a column family, and the sstables that are active in compaction (a subset of the sstables). Modifications to instances are all performed via a Function produced by the static methods in this class. These are composed as necessary and provided to the Tracker.apply() methods, which atomically reject or accept and apply the changes to the View.
-
-
Field Summary
Fields Modifier and Type Field Description java.util.List<Memtable>
flushingMemtables
contains all memtables that are no longer referenced for writing and are queued for / in the process of being flushed.java.util.List<Memtable>
liveMemtables
ordinarily a list of size 1, but when preparing to flush will contain both the memtable we will flush and the new replacement memtable, until all outstanding write operations on the old table complete.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Iterable<SSTableReader>
allKnownSSTables()
java.lang.Iterable<Memtable>
getAllMemtables()
Memtable
getCurrentMemtable()
java.lang.Iterable<SSTableReader>
getUncompacting(java.lang.Iterable<SSTableReader> candidates)
boolean
isEmpty()
java.util.Set<SSTableReader>
liveSSTables()
java.lang.Iterable<SSTableReader>
liveSSTablesInBounds(PartitionPosition left, PartitionPosition right)
Returns the sstables that have any partition betweenleft
andright
, when both bounds are taken inclusively.java.lang.Iterable<SSTableReader>
select(SSTableSet sstableSet)
static com.google.common.base.Function<View,java.lang.Iterable<SSTableReader>>
select(SSTableSet sstableSet, com.google.common.base.Predicate<SSTableReader> filter)
static com.google.common.base.Function<View,java.lang.Iterable<SSTableReader>>
select(SSTableSet sstableSet, DecoratedKey key)
static com.google.common.base.Function<View,java.lang.Iterable<SSTableReader>>
selectFunction(SSTableSet sstableSet)
static com.google.common.base.Function<View,java.lang.Iterable<SSTableReader>>
selectLive(AbstractBounds<PartitionPosition> rowBounds)
java.lang.Iterable<SSTableReader>
sstables(SSTableSet sstableSet, com.google.common.base.Predicate<SSTableReader> filter)
static java.util.List<SSTableReader>
sstablesInBounds(PartitionPosition left, PartitionPosition right, SSTableIntervalTree intervalTree)
java.lang.String
toString()
-
-
-
Field Detail
-
liveMemtables
public final java.util.List<Memtable> liveMemtables
ordinarily a list of size 1, but when preparing to flush will contain both the memtable we will flush and the new replacement memtable, until all outstanding write operations on the old table complete. The last item in the list is always the "current" memtable.
-
flushingMemtables
public final java.util.List<Memtable> flushingMemtables
contains all memtables that are no longer referenced for writing and are queued for / in the process of being flushed. In chronologically ascending order.
-
-
Method Detail
-
getCurrentMemtable
public Memtable getCurrentMemtable()
-
getAllMemtables
public java.lang.Iterable<Memtable> getAllMemtables()
- Returns:
- the active memtable and all the memtables that are pending flush.
-
liveSSTables
public java.util.Set<SSTableReader> liveSSTables()
-
sstables
public java.lang.Iterable<SSTableReader> sstables(SSTableSet sstableSet, com.google.common.base.Predicate<SSTableReader> filter)
-
allKnownSSTables
public java.lang.Iterable<SSTableReader> allKnownSSTables()
-
select
public java.lang.Iterable<SSTableReader> select(SSTableSet sstableSet)
-
getUncompacting
public java.lang.Iterable<SSTableReader> getUncompacting(java.lang.Iterable<SSTableReader> candidates)
-
isEmpty
public boolean isEmpty()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
liveSSTablesInBounds
public java.lang.Iterable<SSTableReader> liveSSTablesInBounds(PartitionPosition left, PartitionPosition right)
Returns the sstables that have any partition betweenleft
andright
, when both bounds are taken inclusively. The interval formed byleft
andright
shouldn't wrap.
-
sstablesInBounds
public static java.util.List<SSTableReader> sstablesInBounds(PartitionPosition left, PartitionPosition right, SSTableIntervalTree intervalTree)
-
selectFunction
public static com.google.common.base.Function<View,java.lang.Iterable<SSTableReader>> selectFunction(SSTableSet sstableSet)
-
select
public static com.google.common.base.Function<View,java.lang.Iterable<SSTableReader>> select(SSTableSet sstableSet, com.google.common.base.Predicate<SSTableReader> filter)
-
select
public static com.google.common.base.Function<View,java.lang.Iterable<SSTableReader>> select(SSTableSet sstableSet, DecoratedKey key)
- Returns:
- a ViewFragment containing the sstables and memtables that may need to be merged for the given @param key, according to the interval tree
-
selectLive
public static com.google.common.base.Function<View,java.lang.Iterable<SSTableReader>> selectLive(AbstractBounds<PartitionPosition> rowBounds)
- Returns:
- a ViewFragment containing the sstables and memtables that may need to be merged for rows within @param rowBounds, inclusive, according to the interval tree.
-
-