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
|
|
|
|
|
|
|
|
|
|
mod builder;
|
|
|
|
|
mod iterator;
|
|
|
|
|
|
|
|
|
|
use bytes::Bytes;
|
|
|
|
|
|
|
|
|
|
pub use builder::BlockBuilder;
|
|
|
|
|
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.
|
2022-12-23 23:45:09 -05:00
|
|
|
pub struct Block {
|
|
|
|
|
data: Vec<u8>,
|
|
|
|
|
offsets: Vec<u16>,
|
|
|
|
|
}
|
2022-12-23 18:44:59 -05:00
|
|
|
|
|
|
|
|
impl Block {
|
|
|
|
|
pub fn encode(&self) -> Bytes {
|
|
|
|
|
unimplemented!()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn decode(data: &[u8]) -> Self {
|
|
|
|
|
unimplemented!()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
|
mod tests;
|