Class PeekablePostingList

java.lang.Object
org.apache.cassandra.index.sai.postings.PeekablePostingList
All Implemented Interfaces:
Closeable, AutoCloseable, PostingList

@NotThreadSafe public class PeekablePostingList extends Object implements PostingList
A peekable wrapper around a PostingList that allows the next value to be looked at without advancing the state of the PostingList
  • Method Details

    • makePeekable

      public static PeekablePostingList makePeekable(PostingList postingList)
    • peek

      public long peek()
    • advanceWithoutConsuming

      public void advanceWithoutConsuming(long targetRowID) throws IOException
      Throws:
      IOException
    • minimum

      public long minimum()
      Specified by:
      minimum in interface PostingList
    • maximum

      public long maximum()
      Specified by:
      maximum in interface PostingList
    • nextPosting

      public long nextPosting() throws IOException
      Description copied from interface: PostingList
      Retrieves the next segment row ID, not including row IDs that have been returned by PostingList.advance(long).
      Specified by:
      nextPosting in interface PostingList
      Returns:
      next segment row ID
      Throws:
      IOException
    • size

      public long size()
      Description copied from interface: PostingList
      Returns the upper bound of postings in the list. During a merge individual postings may be de-duplicated, so we can't return the exact size only the upper bound of the size.
      Specified by:
      size in interface PostingList
    • advance

      public long advance(long targetRowID) throws IOException
      Description copied from interface: PostingList
      Advances to the first row ID beyond the current that is greater than or equal to the target, and returns that row ID. Exhausts the iterator and returns PostingList.END_OF_STREAM if the target is greater than the highest row ID.

      Note: Callers must use the return value of this method before calling PostingList.nextPosting(), as calling that method will return the next posting, not the one to which we have just advanced.

      Specified by:
      advance in interface PostingList
      Parameters:
      targetRowID - target row ID to advance to
      Returns:
      first segment row ID which is >= the target row ID or PostingList.END_OF_STREAM if one does not exist
      Throws:
      IOException
    • close

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