public class IndexSegmentMultiBlockIterator<E> extends Object implements ITupleIterator<E>
IndexSegment. This iterator is designed for operations which will fully visit either all leaves in the
IndexSegmentor a key-range corresponding to a substantial proportion of those leaves. A direct
ByteBufferis allocated from the caller's
DirectBufferPooland an IO request is issued against the
IndexSegmentto fill the
ByteBufferwith as many leaves spanned by the key-range as will fit into the buffer. The leaves laid out contiguously in total key order in the
IndexSegment. The addresses of the leaves spanned by a key-range are easily identified by two key probes into the nodes, and the nodes region is generally fully buffered. The #of leaves spanned by a key range may be estimated as (rangeCount/branchingFactor).
During traversal, each leaf is copied into a Java
order to provide fast decode of the data in the leaf. When the buffered
leaves have been exhausted, another chunk of leaves will be read using
another multi-block IO.
You should choose this iterator if: (a) the iterator uses forward traversal
only; (b) the key-range includes the entire
IndexSegment -or- a probe
reveals that more than a few leaves would be read; (c) the largest record in
IndexSegment will fit within a buffer acquired from the selected
DirectBufferPool; and (d) it is reasonable to expect that the
iterator will be fully consumed by the caller.
The #of leaves which would be read can be estimated by dividing the range
count by the branching factor. If there are more than 2 full leaves worth of
data to be read this iterator will be faster than the linked leaf traversal
IndexSegment.IndexSegmentTupleCursor since this class will do one IO
rather than one per leaf.
|Modifier and Type||Field and Description|
|Constructor and Description|
|Modifier and Type||Method and Description|
Return the current leaf.
Advance the iterator and return the
public IndexSegmentMultiBlockIterator(IndexSegment seg, DirectBufferPool pool, byte fromKey, byte toKey, int flags)
pool- The pool from which a direct
ByteBufferwill be acquired and into which blocks will be read from the backing file.
fromKey- The inclusive lower bound -or-
nullif there is no lower bound.
toKey- The exclusive upper bound -or-
nullif there is no upper bound.
protected void finalize() throws Throwable
This is extended to ensure that the buffer is released back to the
protected IndexSegment.ImmutableNodeFactory.ImmutableLeaf getLeaf()
nulliff no leaves have been read from the
ITuplefrom which you can extract the data and metadata for next entry.
ITupleIterators will generally return the same
ITuple reference on on each invocation of this method. The caller
is responsible for copying out any data or metadata of interest before
ITupleIterator.next() again. See
TupleFilter which is aware of
this and can be used to stack filters safely.
Copyright © 2006–2016 SYSTAP, LLC DBA Blazegraph. All rights reserved.