2022-12-23 18:44:59 -05:00
|
|
|
#![allow(unused_variables)] // TODO(you): remove this lint after implementing this mod
|
|
|
|
|
#![allow(dead_code)] // TODO(you): remove this lint after implementing this mod
|
|
|
|
|
|
|
|
|
|
use std::sync::Arc;
|
|
|
|
|
|
|
|
|
|
use super::Block;
|
|
|
|
|
|
2022-12-23 22:32:30 -05:00
|
|
|
/// Iterates on a block.
|
|
|
|
|
pub struct BlockIterator {
|
|
|
|
|
block: Arc<Block>,
|
|
|
|
|
key: Vec<u8>,
|
|
|
|
|
value: Vec<u8>,
|
|
|
|
|
idx: usize,
|
|
|
|
|
}
|
2022-12-23 18:44:59 -05:00
|
|
|
|
|
|
|
|
impl BlockIterator {
|
|
|
|
|
fn new(block: Arc<Block>) -> Self {
|
2022-12-23 22:32:30 -05:00
|
|
|
Self {
|
|
|
|
|
block,
|
|
|
|
|
key: Vec::new(),
|
|
|
|
|
value: Vec::new(),
|
|
|
|
|
idx: 0,
|
|
|
|
|
}
|
2022-12-23 18:44:59 -05:00
|
|
|
}
|
|
|
|
|
|
2022-12-23 22:32:30 -05:00
|
|
|
/// Creates a block iterator and seek to the first entry.
|
2022-12-23 18:44:59 -05:00
|
|
|
pub fn create_and_seek_to_first(block: Arc<Block>) -> Self {
|
|
|
|
|
unimplemented!()
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-23 22:32:30 -05:00
|
|
|
/// Creates a block iterator and seek to the first key that >= `key`.
|
2022-12-23 18:44:59 -05:00
|
|
|
pub fn create_and_seek_to_key(block: Arc<Block>, key: &[u8]) -> Self {
|
|
|
|
|
unimplemented!()
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-23 22:32:30 -05:00
|
|
|
/// Returns the key of the current entry.
|
2022-12-23 18:44:59 -05:00
|
|
|
pub fn key(&self) -> &[u8] {
|
|
|
|
|
unimplemented!()
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-23 22:32:30 -05:00
|
|
|
/// Returns the value of the current entry.
|
2022-12-23 18:44:59 -05:00
|
|
|
pub fn value(&self) -> &[u8] {
|
|
|
|
|
unimplemented!()
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-23 22:32:30 -05:00
|
|
|
/// Returns true if the iterator is valid.
|
2022-12-23 18:44:59 -05:00
|
|
|
pub fn is_valid(&self) -> bool {
|
|
|
|
|
unimplemented!()
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-23 22:32:30 -05:00
|
|
|
/// Seeks to the first key in the block.
|
2022-12-23 18:44:59 -05:00
|
|
|
pub fn seek_to_first(&mut self) {
|
|
|
|
|
unimplemented!()
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-23 22:32:30 -05:00
|
|
|
/// Move to the next key in the block.
|
2022-12-23 18:44:59 -05:00
|
|
|
pub fn next(&mut self) {
|
|
|
|
|
unimplemented!()
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-23 22:32:30 -05:00
|
|
|
/// Seek to the first key that >= `key`.
|
2022-12-23 18:44:59 -05:00
|
|
|
pub fn seek_to_key(&mut self, key: &[u8]) {
|
|
|
|
|
unimplemented!()
|
|
|
|
|
}
|
|
|
|
|
}
|