Package com.apple.foundationdb.map
Class BunchedMapMultiIterator<K,V,T>
java.lang.Object
com.apple.foundationdb.map.BunchedMapMultiIterator<K,V,T>
- Type Parameters:
K
- type of keys in the mapsV
- type of values in the mapsT
- type of tags associated with each subspace
- All Implemented Interfaces:
AsyncIterator<BunchedMapScanEntry<K,
,V, T>> AsyncPeekIterator<BunchedMapScanEntry<K,
,V, T>> Iterator<BunchedMapScanEntry<K,
V, T>>
@API(EXPERIMENTAL)
public class BunchedMapMultiIterator<K,V,T>
extends Object
implements AsyncPeekIterator<BunchedMapScanEntry<K,V,T>>
An iterator that will return
BunchedMapScanEntry
objects while scanning over multiple
BunchedMap
s. This is the iterator returned by
scanMulti()
.
This iterator will use the provided SubspaceSplitter
to associate each key that it
reads with an underlying subspace. It will return keys in either ascending order or descending
order based on whether it is a "reverse" iterator (i.e., descending) or not. However, it will
sort keys first by subspace (using the unsigned byte order of the underlying prefixes) and
then by key, so use cases that need all keys in a strict order will have to re-sort the items
after they have all been returned by the iterator.-
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
byte[]
Returns a continuation that can be passed to future calls ofBunchedMap.scanMulti()
.int
getLimit()
Returns the maximum number of entries that this iterator will return.boolean
hasNext()
boolean
Returns whether this iterator returns keys in reverse order.next()
peek()
Get the next item of the scan without advancing it.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Method Details
-
onHasNext
- Specified by:
onHasNext
in interfaceAsyncIterator<K>
-
hasNext
public boolean hasNext() -
peek
Description copied from interface:AsyncPeekIterator
Get the next item of the scan without advancing it. This item can be called multiple times, and it should return the same value each time as long as there are no intervening calls tonext()
.- Specified by:
peek
in interfaceAsyncPeekIterator<K>
- Returns:
- the next item that will be returned by
next()
-
next
-
getContinuation
@Nullable public byte[] getContinuation()Returns a continuation that can be passed to future calls ofBunchedMap.scanMulti()
. If the iterator has not yet returned anything or if the iterator is exhausted, then this will returnnull
. An iterator will be marked as exhausted only if there are no more elements in any of the maps being scanned.- Returns:
- a continuation that can be used to resume iteration later
-
isReverse
public boolean isReverse()Returns whether this iterator returns keys in reverse order. Forward order is defined to be ascending order by subspace according to the byte prefixes of each one followed by key order within a subspace. Reverse order is thus equivalent to descending order.- Returns:
- whether this iterator returns values in reverse order
-
getLimit
public int getLimit()Returns the maximum number of entries that this iterator will return. It will returnReadTransaction.ROW_LIMIT_UNLIMITED
if this iterator has no limit.- Returns:
- the limit of this iterator
-
cancel
public void cancel()- Specified by:
cancel
in interfaceAsyncIterator<K>
-