mini_lsm/iterators.rs
1pub mod concat_iterator;
2pub mod merge_iterator;
3pub mod two_merge_iterator;
4
5pub trait StorageIterator {
6 type KeyType<'a>: PartialEq + Eq + PartialOrd + Ord
7 where
8 Self: 'a;
9
10 /// Get the current value.
11 fn value(&self) -> &[u8];
12
13 /// Get the current key.
14 fn key(&self) -> Self::KeyType<'_>;
15
16 /// Check if the current iterator is valid.
17 fn is_valid(&self) -> bool;
18
19 /// Move to the next position.
20 fn next(&mut self) -> anyhow::Result<()>;
21
22 /// Number of underlying active iterators for this iterator.
23 fn num_active_iterators(&self) -> usize {
24 1
25 }
26}