From b263ea4fac2708575b5f1d651f573a315f16482a Mon Sep 17 00:00:00 2001 From: Alex Chi Date: Sat, 24 Dec 2022 00:26:11 -0500 Subject: [PATCH] chore(docs): refine part 1, 2 Signed-off-by: Alex Chi --- mini-lsm-book/src/00-overview.md | 2 ++ mini-lsm-book/src/01-block.md | 2 ++ mini-lsm-starter/src/table.rs | 6 +++++- mini-lsm-starter/src/table/builder.rs | 1 + xtask/src/main.rs | 9 +++++++++ 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/mini-lsm-book/src/00-overview.md b/mini-lsm-book/src/00-overview.md index 9df5f3e..1701831 100644 --- a/mini-lsm-book/src/00-overview.md +++ b/mini-lsm-book/src/00-overview.md @@ -1,5 +1,7 @@ # Overview + + In this tutorial, you will learn how to build a simple LSM-Tree storage engine in the Rust programming language. ## What is LSM, and Why LSM? diff --git a/mini-lsm-book/src/01-block.md b/mini-lsm-book/src/01-block.md index 68daa82..6e0ebd1 100644 --- a/mini-lsm-book/src/01-block.md +++ b/mini-lsm-book/src/01-block.md @@ -1,5 +1,7 @@ # Block Builder and Block Iterator + + In this part, you will need to modify: * `src/block/builder.rs` diff --git a/mini-lsm-starter/src/table.rs b/mini-lsm-starter/src/table.rs index 55ef302..1a55831 100644 --- a/mini-lsm-starter/src/table.rs +++ b/mini-lsm-starter/src/table.rs @@ -57,7 +57,11 @@ impl FileObject { } } -pub struct SsTable {} +pub struct SsTable { + file: FileObject, + block_metas: Vec, + block_meta_offset: usize, +} impl SsTable { /// Open SSTable from a file. diff --git a/mini-lsm-starter/src/table/builder.rs b/mini-lsm-starter/src/table/builder.rs index e37d204..ff4561d 100644 --- a/mini-lsm-starter/src/table/builder.rs +++ b/mini-lsm-starter/src/table/builder.rs @@ -9,6 +9,7 @@ use super::{BlockMeta, SsTable}; /// Builds an SSTable from key-value pairs. pub struct SsTableBuilder { pub(super) meta: Vec, + // Add other fields you need. } impl SsTableBuilder { diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 0c2b26a..dd55f20 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -8,6 +8,7 @@ use duct::cmd; #[derive(clap::Subcommand, Debug)] enum CopyTestAction { Day1, + Day2, } #[derive(clap::Subcommand, Debug)] @@ -132,6 +133,14 @@ fn copy_test_case(test: CopyTestAction) -> Result<()> { ) .run()?; } + CopyTestAction::Day2 => { + cmd!( + "cp", + "mini-lsm/src/table/tests.rs", + "mini-lsm-starter/src/table/tests.rs" + ) + .run()?; + } } Ok(()) }