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 aPriorityQueue
of multiple SortedKeyValueIterators. Provides a simple way to interact with multiple SortedKeyValueIterators in sorted order.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
HeapIterator()
protected
HeapIterator(int maxSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addSource(SortedKeyValueIterator<Key,Value> source)
protected void
clear()
protected void
createHeap(int maxSize)
Key
getTopKey()
Returns top key.Value
getTopValue()
Returns top value.boolean
hasTop()
Returns true if the iterator has more elements.void
next()
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, isRunningLowOnMemory, 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:SortedKeyValueIterator
Returns 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
getTopKey
whenSortedKeyValueIterator.next()
is called, changing the data that the object references. Iterators that need to save an object returned bygetTopKey
ought to copy the object's data into a new object in order to avoid aliasing bugs.- Specified by:
getTopKey
in interfaceSortedKeyValueIterator<Key,Value>
- Returns:
K
-
getTopValue
public final Value getTopValue()
Description copied from interface:SortedKeyValueIterator
Returns 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
getTopValue
whenSortedKeyValueIterator.next()
is called, changing the underlying data that the object references. Iterators that need to save an object returned bygetTopValue
ought to copy the object's data into a new object in order to avoid aliasing bugs.- Specified by:
getTopValue
in interfaceSortedKeyValueIterator<Key,Value>
- Returns:
V
-
hasTop
public final boolean hasTop()
Description copied from interface:SortedKeyValueIterator
Returns 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:
hasTop
in interfaceSortedKeyValueIterator<Key,Value>
- Returns:
true
if the iterator has more elements.
-
next
public final void next() throws IOException
Description copied from interface:SortedKeyValueIterator
Advances 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:
next
in 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)
-
-