Skip to content

Commit f1ccde0

Browse files
committed
Add LevelDB-backed implementation of MetadataStore
1 parent ad890a0 commit f1ccde0

6 files changed

Lines changed: 321 additions & 6 deletions

File tree

Cargo.lock

Lines changed: 184 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ base64 = "0.22"
2121
blake3 = "1.8"
2222
dashmap = "6.1"
2323
tokio = { version = "1.49", default-features = false }
24+
25+
# Chosen over `leveldb` crate which requires C++ LevelDB via FFI.
26+
rusty-leveldb = "1"

minikv-core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ tracing.workspace = true
1616
base64 = { workspace = true }
1717
blake3 = { workspace = true }
1818
dashmap = { workspace = true }
19+
rusty-leveldb = { workspace = true }
1920

2021
[dev-dependencies]
2122
tokio = { workspace = true, features = ["full"] }

minikv-core/src/error.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
use thiserror::Error;
2-
31
/// Unified error type for minikv.
4-
#[derive(Debug, Error)]
5-
pub enum Error {}
2+
#[derive(Debug, thiserror::Error)]
3+
pub enum Error {
4+
/// Errors from the rusty-leveldb storage engine.
5+
#[error("LevelDB error: {0}")]
6+
LevelDb(String),
7+
}
8+
9+
impl From<rusty_leveldb::Status> for Error {
10+
fn from(s: rusty_leveldb::Status) -> Self {
11+
Error::LevelDb(s.to_string())
12+
}
13+
}

0 commit comments

Comments
 (0)