pub struct PooledIterator { /* private fields */ }Expand description
A pooled iterator that automatically returns to the global pool on drop.
Wraps a DBIterator and implements Deref/DerefMut so it can be used
identically. When dropped, the iterator is reset (releasing Arc<TableReader>
references) and returned to the global pool for reuse by any thread.
Implementations§
Source§impl PooledIterator
impl PooledIterator
Sourcepub fn new(iter: DBIterator) -> Self
pub fn new(iter: DBIterator) -> Self
Wrap a DBIterator for automatic pool return on drop.
Sourcepub fn into_inner(self) -> DBIterator ⓘ
pub fn into_inner(self) -> DBIterator ⓘ
Take ownership of the inner iterator, disabling automatic pool return.
Methods from Deref<Target = DBIterator>§
Sourcepub fn reset(&mut self, sources: Vec<IterSource>, sequence: SequenceNumber)
pub fn reset(&mut self, sources: Vec<IterSource>, sequence: SequenceNumber)
Reset the iterator with new sources and sequence, reusing allocated memory. Used by the iterator pool to avoid per-iteration allocation overhead.
Sourcepub fn reset_with_prefix(
&mut self,
sources: Vec<IterSource>,
sequence: SequenceNumber,
prefix: Vec<u8>,
)
pub fn reset_with_prefix( &mut self, sources: Vec<IterSource>, sequence: SequenceNumber, prefix: Vec<u8>, )
Reset with prefix-bounded iteration, reusing allocated memory.
Sourcepub fn set_range_tombstones(
&mut self,
tombstones: Vec<(Vec<u8>, Vec<u8>, SequenceNumber)>,
)
pub fn set_range_tombstones( &mut self, tombstones: Vec<(Vec<u8>, Vec<u8>, SequenceNumber)>, )
Set pre-collected range tombstones. Called by the DB layer after collecting tombstones from all memtables and SST files.
Sourcepub fn set_range_tombstones_with_levels(
&mut self,
tombstones: Vec<(Vec<u8>, Vec<u8>, SequenceNumber, usize)>,
)
pub fn set_range_tombstones_with_levels( &mut self, tombstones: Vec<(Vec<u8>, Vec<u8>, SequenceNumber, usize)>, )
Set range tombstones with level info for cross-level pruning. A tombstone from level L can only delete keys from levels > L.
Sourcepub fn set_no_range_deletions(&mut self)
pub fn set_no_range_deletions(&mut self)
No-op: tombstones are loaded upfront; emptiness is checked via is_empty().
Sourcepub fn set_upper_bound(&mut self, bound: Vec<u8>)
pub fn set_upper_bound(&mut self, bound: Vec<u8>)
Set an exclusive upper bound on user keys.
Iteration stops when user key >= this bound.
Models RocksDB’s ReadOptions::iterate_upper_bound.
Sourcepub fn set_lower_bound(&mut self, bound: Vec<u8>)
pub fn set_lower_bound(&mut self, bound: Vec<u8>)
Set an inclusive lower bound on user keys.
Sourcepub fn set_bounds(&mut self, lower: Option<Vec<u8>>, upper: Option<Vec<u8>>)
pub fn set_bounds(&mut self, lower: Option<Vec<u8>>, upper: Option<Vec<u8>>)
Set both lower (inclusive) and upper (exclusive) bounds on user keys.
Sourcepub fn error(&self) -> Option<String>
pub fn error(&self) -> Option<String>
Return the first error from any underlying source iterator.
Use after iteration returns None to distinguish normal exhaustion
from I/O failures.
Sourcepub fn set_skip_point(&mut self, f: SkipPointFn)
pub fn set_skip_point(&mut self, f: SkipPointFn)
Set a skip-point callback. During iteration, any user key for which
the callback returns true is silently skipped.
Sourcepub fn next_prefix(&mut self, prefix_len: usize)
pub fn next_prefix(&mut self, prefix_len: usize)
Jump to the first key of the next prefix, skipping all remaining keys
under the current prefix in O(log N) instead of O(keys_in_prefix).
prefix_len is the number of bytes that define a prefix.
pub fn valid(&mut self) -> bool
pub fn key(&mut self) -> Option<&[u8]>
pub fn value(&mut self) -> Option<&[u8]>
pub fn advance(&mut self)
pub fn seek_to_first(&mut self)
Sourcepub fn reset_and_seek_to_first(&mut self)
pub fn reset_and_seek_to_first(&mut self)
Fully reset internal deduplication/tombstone state, then seek to first. Used by BidiIterator when materializing after a seek_to_last().
Sourcepub fn seek_for_prev(&mut self, target: &[u8])
pub fn seek_for_prev(&mut self, target: &[u8])
Seek to the last visible user key <= target.
Uses a single backward seek + inline resolution. No redundant forward seek.
Sourcepub fn prev(&mut self)
pub fn prev(&mut self)
Move to the previous visible user key.
Uses inline backward resolution: O(1) amortized per call.
Sourcepub fn seek_to_last(&mut self)
pub fn seek_to_last(&mut self)
Seek to the last visible key. Positions the iterator on the very last entry.
If a prefix is set, seeks to the last key within the prefix. Uses merger backward seek to find the last user key efficiently, then resolves visibility inline (no forward re-seek).
Sourcepub fn last_user_key(&self) -> Option<&[u8]>
pub fn last_user_key(&self) -> Option<&[u8]>
Return the last user key seen by next_visible(), if any. Used by BidiIterator for re-seeking on direction change.