sync api with refsol

Signed-off-by: Alex Chi <iskyzh@gmail.com>
This commit is contained in:
Alex Chi
2024-01-24 14:37:16 +08:00
parent 9473c89330
commit 4d676a451a
5 changed files with 18 additions and 5 deletions

6
Cargo.lock generated
View File

@@ -405,7 +405,7 @@ dependencies = [
[[package]]
name = "mini-lsm"
version = "0.1.0"
version = "0.2.0"
dependencies = [
"anyhow",
"arc-swap",
@@ -426,7 +426,7 @@ dependencies = [
[[package]]
name = "mini-lsm-starter"
version = "0.1.0"
version = "0.2.0"
dependencies = [
"anyhow",
"arc-swap",
@@ -447,7 +447,7 @@ dependencies = [
[[package]]
name = "mini-lsm-xtask"
version = "0.1.0"
version = "0.2.0"
dependencies = [
"anyhow",
"clap",

View File

@@ -3,7 +3,7 @@ members = ["mini-lsm", "xtask", "mini-lsm-starter"]
resolver = "2"
[workspace.package]
version = "0.1.0"
version = "0.2.0"
edition = "2021"
homepage = "https://github.com/skyzh/mini-lsm"
keywords = ["storage", "database", "tutorial"]

View File

@@ -1,6 +1,6 @@
[package]
name = "mini-lsm-starter"
version = "0.1.0"
version = "0.2.0"
edition = "2021"
publish = false

View File

@@ -158,6 +158,10 @@ impl MiniLsm {
self.inner.delete(key)
}
pub fn sync(&self) -> Result<()> {
self.inner.sync()
}
pub fn scan(
&self,
lower: Bound<&[u8]>,
@@ -222,6 +226,10 @@ impl LsmStorageInner {
Ok(storage)
}
pub fn sync(&self) -> Result<()> {
unimplemented!()
}
/// Get a key from the storage. In day 7, this can be further optimized by using a bloom filter.
pub fn get(&self, _key: &[u8]) -> Result<Option<Bytes>> {
unimplemented!()

View File

@@ -111,6 +111,11 @@ fn sync() -> Result<()> {
std::fs::read_to_string(cargo_toml)?.replace("mini-lsm-starter", "mini-lsm")
+ "\n[workspace]\n",
)?;
let wrapper_rs = "sync-tmp/mini-lsm-starter/src/bin/wrapper.rs";
std::fs::write(
wrapper_rs,
std::fs::read_to_string(wrapper_rs)?.replace("mini_lsm_starter", "mini_lsm"),
)?;
cmd!(
"cargo",
"semver-checks",