pub struct TwoLevelIterator {
table: Arc<Table>,
read_options: ReadOptions,
index_block_iter: BlockIter<InternalKey>,
maybe_data_block_iter: Option<BlockIter<InternalKey>>,
data_block_handle: Option<BlockHandle>,
}
Expand description
A two-level iterator that first iterates the index block and then iterates a corresponding data block. NOTE: This iterator is initially invalid until an operation is performed with it.
This iterator yields the concatenation of all key-value pairs in a sequence of blocks (e.g. in a table file).
Fields§
§table: Arc<Table>
The table the iterator is for.
read_options: ReadOptions
Options for configuring the behavior of reads done by the iterator.
index_block_iter: BlockIter<InternalKey>
Iterator for the index block.
maybe_data_block_iter: Option<BlockIter<InternalKey>>
Iterator for a data block.
data_block_handle: Option<BlockHandle>
The block handle used to get the data block in the [TwoLevelIterator::data_block
] field.
Implementations§
Source§impl TwoLevelIterator
Private methods
impl TwoLevelIterator
Private methods
Sourcefn new(table: Arc<Table>, read_options: ReadOptions) -> Self
fn new(table: Arc<Table>, read_options: ReadOptions) -> Self
Create a new instance of TwoLevelIterator
.
fn init_data_block(&mut self) -> Result<(), ReadError>
Sourcefn skip_empty_data_blocks_forward(&mut self) -> Result<(), ReadError>
fn skip_empty_data_blocks_forward(&mut self) -> Result<(), ReadError>
Move the index iterator and data iterator forward until we find a non-empty block.
Sourcefn skip_empty_data_blocks_backward(&mut self) -> Result<(), ReadError>
fn skip_empty_data_blocks_backward(&mut self) -> Result<(), ReadError>
Move the index iterator and data iterator backward until we find a non-empty block.
If a data block is found, this will set the data block iterator to the last entry of the data block.