@@ -4,3 +4,6 @@ pub mod lsm_iterator;
|
||||
pub mod lsm_storage;
|
||||
pub mod mem_table;
|
||||
pub mod table;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
@@ -39,7 +39,7 @@ pub struct LsmStorage {
|
||||
}
|
||||
|
||||
impl LsmStorage {
|
||||
pub fn open(_path: &Path) -> Result<Self> {
|
||||
pub fn open(path: impl AsRef<Path>) -> Result<Self> {
|
||||
Ok(Self {
|
||||
inner: ArcSwap::from_pointee(LsmStorageInner::create()),
|
||||
})
|
||||
@@ -49,17 +49,17 @@ impl LsmStorage {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn put(&mut self, key: &[u8], value: &[u8]) -> Result<()> {
|
||||
pub fn put(&self, key: &[u8], value: &[u8]) -> Result<()> {
|
||||
assert!(!value.is_empty(), "value cannot be empty");
|
||||
assert!(!key.is_empty(), "key cannot be empty");
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn delete(&mut self, _key: &[u8]) -> Result<()> {
|
||||
pub fn delete(&self, _key: &[u8]) -> Result<()> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn sync(&mut self) -> Result<()> {
|
||||
pub fn sync(&self) -> Result<()> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
|
1
mini-lsm-starter/src/tests.rs
Normal file
1
mini-lsm-starter/src/tests.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod day4_tests;
|
1
mini-lsm-starter/src/tests/day4_tests.rs
Normal file
1
mini-lsm-starter/src/tests/day4_tests.rs
Normal file
@@ -0,0 +1 @@
|
||||
//! Please copy `mini-lsm/src/tests/day4_tests.rs` here so that you can run tests.
|
@@ -1 +1 @@
|
||||
pub mod day3_tests;
|
||||
pub mod day4_tests;
|
||||
|
@@ -10,6 +10,7 @@ enum CopyTestAction {
|
||||
Day1,
|
||||
Day2,
|
||||
Day3,
|
||||
Day4,
|
||||
}
|
||||
|
||||
#[derive(clap::Subcommand, Debug)]
|
||||
@@ -168,6 +169,14 @@ fn copy_test_case(test: CopyTestAction) -> Result<()> {
|
||||
)
|
||||
.run()?;
|
||||
}
|
||||
CopyTestAction::Day4 => {
|
||||
cmd!(
|
||||
"cp",
|
||||
"mini-lsm/src/tests/day4_tests.rs",
|
||||
"mini-lsm-starter/src/tests/day4_tests.rs"
|
||||
)
|
||||
.run()?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user