#![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; /// Iterates on a block. pub struct BlockIterator { /// The internal `Block`, wrapped by an `Arc` block: Arc, /// The current key, empty represents the iterator is invalid key: Vec, /// The corresponding value, can be empty value: Vec, /// Current index of the key-value pair, should be in range of [0, num_of_elements) idx: usize, } impl BlockIterator { fn new(block: Arc) -> Self { Self { block, key: Vec::new(), value: Vec::new(), idx: 0, } } /// Creates a block iterator and seek to the first entry. pub fn create_and_seek_to_first(block: Arc) -> Self { unimplemented!() } /// Creates a block iterator and seek to the first key that >= `key`. pub fn create_and_seek_to_key(block: Arc, key: &[u8]) -> Self { unimplemented!() } /// Returns the key of the current entry. pub fn key(&self) -> &[u8] { unimplemented!() } /// Returns the value of the current entry. pub fn value(&self) -> &[u8] { unimplemented!() } /// Returns true if the iterator is valid. /// Note: You may want to make use of `key` pub fn is_valid(&self) -> bool { unimplemented!() } /// Seeks to the first key in the block. pub fn seek_to_first(&mut self) { unimplemented!() } /// Move to the next key in the block. pub fn next(&mut self) { unimplemented!() } /// Seek to the first key that >= `key`. /// Note: You should assume the key-value pairs in the block are sorted when being added by callers. pub fn seek_to_key(&mut self, key: &[u8]) { unimplemented!() } }