* relicense mini-lsm-book to CC BY-NC-SA 4.0 Signed-off-by: Alex Chi Z <iskyzh@gmail.com> * clearify license Signed-off-by: Alex Chi Z <iskyzh@gmail.com> * fix fmt Signed-off-by: Alex Chi Z <iskyzh@gmail.com> * fix fmt Signed-off-by: Alex Chi Z <iskyzh@gmail.com> --------- Signed-off-by: Alex Chi Z <iskyzh@gmail.com>
41 lines
1.2 KiB
Rust
41 lines
1.2 KiB
Rust
// Copyright (c) 2022-2025 Alex Chi Z
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
pub mod concat_iterator;
|
|
pub mod merge_iterator;
|
|
pub mod two_merge_iterator;
|
|
|
|
pub trait StorageIterator {
|
|
type KeyType<'a>: PartialEq + Eq + PartialOrd + Ord
|
|
where
|
|
Self: 'a;
|
|
|
|
/// Get the current value.
|
|
fn value(&self) -> &[u8];
|
|
|
|
/// Get the current key.
|
|
fn key(&self) -> Self::KeyType<'_>;
|
|
|
|
/// Check if the current iterator is valid.
|
|
fn is_valid(&self) -> bool;
|
|
|
|
/// Move to the next position.
|
|
fn next(&mut self) -> anyhow::Result<()>;
|
|
|
|
/// Number of underlying active iterators for this iterator.
|
|
fn num_active_iterators(&self) -> usize {
|
|
1
|
|
}
|
|
}
|