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.

  • Constructor Details

  • Method Details

    • getMinimum

      public final PrimaryKey getMinimum()
    • getMaximum

      public final PrimaryKey getMaximum()
    • getMaxKeys

      public final long getMaxKeys()
      Returns:
      an upper bound on the number of keys that can be returned by this iterator.
    • skipTo

      public final void skipTo(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 iterator
      Parameters:
      nextKey - value to skip the iterator forward until matching
    • performSkipTo

      protected abstract void performSkipTo(PrimaryKey nextKey)
      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

      public void setOnClose(Runnable onClose)
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • empty

      public static KeyRangeIterator empty()
    • nullSafeMin

      protected static PrimaryKey nullSafeMin(PrimaryKey a, PrimaryKey b)
    • nullSafeMax

      protected static PrimaryKey nullSafeMax(PrimaryKey a, PrimaryKey b)