Files
mini_lsm/mini-lsm-starter/src/block.rs
Alex Chi Z f88394a686 add week 1 day 3 blocks
Signed-off-by: Alex Chi Z <iskyzh@gmail.com>
2024-01-21 13:55:49 +08:00

29 lines
891 B
Rust

#![allow(unused_variables)] // TODO(you): remove this lint after implementing this mod
#![allow(dead_code)] // TODO(you): remove this lint after implementing this mod
mod builder;
mod iterator;
pub use builder::BlockBuilder;
use bytes::Bytes;
pub use iterator::BlockIterator;
/// A block is the smallest unit of read and caching in LSM tree. It is a collection of sorted key-value pairs.
pub struct Block {
pub(crate) data: Vec<u8>,
pub(crate) offsets: Vec<u16>,
}
impl Block {
/// Encode the internal data to the data layout illustrated in the tutorial
/// Note: You may want to recheck if any of the expected field is missing from your output
pub fn encode(&self) -> Bytes {
unimplemented!()
}
/// Decode from the data layout, transform the input `data` to a single `Block`
pub fn decode(data: &[u8]) -> Self {
unimplemented!()
}
}