Class KeyRangeIterator
java.lang.Object
org.apache.cassandra.utils.AbstractGuavaIterator<PrimaryKey>
org.apache.cassandra.index.sai.iterators.KeyRangeIterator
- All Implemented Interfaces:
com.google.common.collect.PeekingIterator<PrimaryKey>,Closeable,AutoCloseable,Iterator<PrimaryKey>
- Direct Known Subclasses:
IndexSearchResultIterator,InMemoryKeyRangeIterator,KeyRangeConcatIterator,KeyRangeIntersectionIterator,KeyRangeUnionIterator,PostingListRangeIterator
@NotThreadSafe
public abstract class KeyRangeIterator
extends AbstractGuavaIterator<PrimaryKey>
implements Closeable
An abstract implementation of
AbstractGuavaIterator that supports the building and management of
concatanation, union and intersection iterators.
Range iterators contain primary keys, in sorted order, with no duplicates. They also know their minimum and maximum keys, and an upper bound on the number of keys they contain.
Only certain methods are designed to be overriden. The others are marked private or final.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.cassandra.utils.AbstractGuavaIterator
AbstractGuavaIterator.State -
Field Summary
Fields inherited from class org.apache.cassandra.utils.AbstractGuavaIterator
next, state -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedKeyRangeIterator(KeyRangeIterator.Builder.Statistics statistics, Runnable onClose) KeyRangeIterator(KeyRangeIterator range, Runnable onClose) KeyRangeIterator(PrimaryKey min, PrimaryKey max, long count) KeyRangeIterator(PrimaryKey min, PrimaryKey max, long count, Runnable onClose) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static KeyRangeIteratorempty()final PrimaryKeyfinal longfinal PrimaryKeyprotected static PrimaryKeynullSafeMax(PrimaryKey a, PrimaryKey b) protected static PrimaryKeynullSafeMin(PrimaryKey a, PrimaryKey b) protected abstract voidperformSkipTo(PrimaryKey nextKey) Skip to nextKey.voidsetOnClose(Runnable onClose) final voidskipTo(PrimaryKey nextKey) When called, this iterator's current position will be skipped forwards until finding either: 1) an element equal to or bigger than nextKey 2) the end of the iteratorMethods inherited from class org.apache.cassandra.utils.AbstractGuavaIterator
computeNext, endOfData, hasNext, next, peek, remove, tryToComputeNextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
KeyRangeIterator
-
KeyRangeIterator
-
KeyRangeIterator
-
KeyRangeIterator
-
-
Method Details
-
getMinimum
-
getMaximum
-
getMaxKeys
public final long getMaxKeys()- Returns:
- an upper bound on the number of keys that can be returned by this iterator.
-
skipTo
When called, this iterator's current position will be skipped forwards until finding either: 1) an element equal to or bigger than nextKey 2) the end of the iterator- Parameters:
nextKey- value to skip the iterator forward until matching
-
performSkipTo
Skip to nextKey.That is, implementations should set up the iterator state such that calling computeNext() will return nextKey if present, or the first one after it if not present.
-
setOnClose
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
empty
-
nullSafeMin
-
nullSafeMax
-