12
mini-lsm-starter/Cargo.toml
Normal file
12
mini-lsm-starter/Cargo.toml
Normal file
@@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "mini-lsm-starter"
|
||||
version = { workspace = true }
|
||||
edition = { workspace = true }
|
||||
homepage = { workspace = true }
|
||||
keywords = { workspace = true }
|
||||
license = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
bytes = "1"
|
||||
26
mini-lsm-starter/src/block.rs
Normal file
26
mini-lsm-starter/src/block.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
#![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.
|
||||
pub struct Block {}
|
||||
|
||||
impl Block {
|
||||
pub fn encode(&self) -> Bytes {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn decode(data: &[u8]) -> Self {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
29
mini-lsm-starter/src/block/builder.rs
Normal file
29
mini-lsm-starter/src/block/builder.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
#![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 super::Block;
|
||||
|
||||
/// Builds a block
|
||||
pub struct BlockBuilder {}
|
||||
|
||||
impl BlockBuilder {
|
||||
/// Creates a new block builder
|
||||
pub fn new(target_size: usize) -> Self {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// Adds a key-value pair to the block
|
||||
#[must_use]
|
||||
pub fn add(&mut self, key: &[u8], value: &[u8]) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// Builds a block
|
||||
pub fn build(self) -> Block {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
62
mini-lsm-starter/src/block/iterator.rs
Normal file
62
mini-lsm-starter/src/block/iterator.rs
Normal file
@@ -0,0 +1,62 @@
|
||||
#![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;
|
||||
|
||||
pub struct BlockIterator {}
|
||||
|
||||
impl BlockIterator {
|
||||
fn new(block: Arc<Block>) -> Self {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn create_and_seek_to_first(block: Arc<Block>) -> Self {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn create_and_seek_to_key(block: Arc<Block>, key: &[u8]) -> Self {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn key(&self) -> &[u8] {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn value(&self) -> &[u8] {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn is_valid(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn seek_to_first(&mut self) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn seek_to_last(&mut self) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn seek_to(&mut self, idx: usize) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn next(&mut self) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn seek_to_key(&mut self, key: &[u8]) {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
1
mini-lsm-starter/src/block/tests.rs
Normal file
1
mini-lsm-starter/src/block/tests.rs
Normal file
@@ -0,0 +1 @@
|
||||
//! Please copy `mini-lsm/src/block/tests.rs` here so that you can run tests.
|
||||
1
mini-lsm-starter/src/lib.rs
Normal file
1
mini-lsm-starter/src/lib.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod block;
|
||||
Reference in New Issue
Block a user