Class HeapIterator
- java.lang.Object
-
- org.apache.accumulo.core.iteratorsImpl.system.HeapIterator
-
- All Implemented Interfaces:
SortedKeyValueIterator<Key,Value>,YieldingKeyValueIterator<Key,Value>
- Direct Known Subclasses:
LocalityGroupIterator,MultiIterator,RFile.Reader
public abstract class HeapIterator extends Object implements SortedKeyValueIterator<Key,Value>
Constructs aPriorityQueueof multiple SortedKeyValueIterators. Provides a simple way to interact with multiple SortedKeyValueIterators in sorted order.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedHeapIterator()protectedHeapIterator(int maxSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddSource(SortedKeyValueIterator<Key,Value> source)protected voidclear()protected voidcreateHeap(int maxSize)KeygetTopKey()Returns top key.ValuegetTopValue()Returns top value.booleanhasTop()Returns true if the iterator has more elements.voidnext()Advances to the next K,V pair.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.accumulo.core.iterators.SortedKeyValueIterator
deepCopy, init, seek
-
Methods inherited from interface org.apache.accumulo.core.iterators.YieldingKeyValueIterator
enableYielding
-
-
-
-
Method Detail
-
createHeap
protected void createHeap(int maxSize)
-
getTopKey
public final Key getTopKey()
Description copied from interface:SortedKeyValueIteratorReturns top key. Can be called 0 or more times without affecting behavior of next() or hasTop(). Note that in minor compaction scope and in non-full major compaction scopes the iterator may see deletion entries. These entries should be preserved by all iterators except ones that are strictly scan-time iterators that will never be configured for the minc or majc scopes. Deletion entries are only removed during full major compactions.For performance reasons, iterators reserve the right to reuse objects returned by
getTopKeywhenSortedKeyValueIterator.next()is called, changing the data that the object references. Iterators that need to save an object returned bygetTopKeyought to copy the object's data into a new object in order to avoid aliasing bugs.- Specified by:
getTopKeyin interfaceSortedKeyValueIterator<Key,Value>- Returns:
K
-
getTopValue
public final Value getTopValue()
Description copied from interface:SortedKeyValueIteratorReturns top value. Can be called 0 or more times without affecting behavior of next() or hasTop().For performance reasons, iterators reserve the right to reuse objects returned by
getTopValuewhenSortedKeyValueIterator.next()is called, changing the underlying data that the object references. Iterators that need to save an object returned bygetTopValueought to copy the object's data into a new object in order to avoid aliasing bugs.- Specified by:
getTopValuein interfaceSortedKeyValueIterator<Key,Value>- Returns:
V
-
hasTop
public final boolean hasTop()
Description copied from interface:SortedKeyValueIteratorReturns true if the iterator has more elements. Note that if this iterator has yielded (@see YieldingKeyValueIterator.enableYielding(YieldCallback)), this this method must return false.- Specified by:
hasTopin interfaceSortedKeyValueIterator<Key,Value>- Returns:
trueif the iterator has more elements.
-
next
public final void next() throws IOExceptionDescription copied from interface:SortedKeyValueIteratorAdvances to the next K,V pair. Note that in minor compaction scope and in non-full major compaction scopes the iterator may see deletion entries. These entries should be preserved by all iterators except ones that are strictly scan-time iterators that will never be configured for the minc or majc scopes. Deletion entries are only removed during full major compactions.- Specified by:
nextin interfaceSortedKeyValueIterator<Key,Value>- Throws:
IOException- if an I/O error occurs.
-
clear
protected final void clear()
-
addSource
protected final void addSource(SortedKeyValueIterator<Key,Value> source)
-
-