Class PeekablePostingList
java.lang.Object
org.apache.cassandra.index.sai.postings.PeekablePostingList
- All Implemented Interfaces:
Closeable,AutoCloseable,PostingList
A peekable wrapper around a
PostingList that allows the next value to be
looked at without advancing the state of the PostingList-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.cassandra.index.sai.postings.PostingList
PostingList.EmptyPostingList -
Field Summary
Fields inherited from interface org.apache.cassandra.index.sai.postings.PostingList
EMPTY, END_OF_STREAM, OFFSET_NOT_FOUND -
Method Summary
Modifier and TypeMethodDescriptionlongadvance(long targetRowID) Advances to the first row ID beyond the current that is greater than or equal to the target, and returns that row ID.voidadvanceWithoutConsuming(long targetRowID) voidclose()static PeekablePostingListmakePeekable(PostingList postingList) longmaximum()longminimum()longRetrieves the next segment row ID, not including row IDs that have been returned byPostingList.advance(long).longpeek()longsize()Returns the upper bound of postings in the list.
-
Method Details
-
makePeekable
-
peek
public long peek() -
advanceWithoutConsuming
- Throws:
IOException
-
minimum
public long minimum()- Specified by:
minimumin interfacePostingList
-
maximum
public long maximum()- Specified by:
maximumin interfacePostingList
-
nextPosting
Description copied from interface:PostingListRetrieves the next segment row ID, not including row IDs that have been returned byPostingList.advance(long).- Specified by:
nextPostingin interfacePostingList- Returns:
- next segment row ID
- Throws:
IOException
-
size
public long size()Description copied from interface:PostingListReturns 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:
sizein interfacePostingList
-
advance
Description copied from interface:PostingListAdvances 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 returnsPostingList.END_OF_STREAMif 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:
advancein interfacePostingList- Parameters:
targetRowID- target row ID to advance to- Returns:
- first segment row ID which is >= the target row ID or
PostingList.END_OF_STREAMif one does not exist - Throws:
IOException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfacePostingList
-