Skip to content

Commit

Permalink
Feature: add rocks-store as a RaftStorage implementation based on r…
Browse files Browse the repository at this point in the history
…ocks-db
  • Loading branch information
drmingdrmer committed Feb 22, 2023
1 parent c6fe29d commit 9a22bb0
Show file tree
Hide file tree
Showing 6 changed files with 705 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
members = [
"openraft",
"memstore",
"rocksstore",
]
2 changes: 1 addition & 1 deletion memstore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tokio = { version="1.0", default-features=false, features=["sync"] }
tracing = "0.1.29"
tracing-futures = "0.2.4"

openraft = { version="0.7.3", path= "../openraft" }
openraft = { path= "../openraft" }

[dev-dependencies]
anyhow = "1.0.63"
Expand Down
8 changes: 7 additions & 1 deletion openraft/src/types/v070/effective_membership.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ use super::Membership;
/// - and the config.
///
/// An active config is just the last seen config in raft spec.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct EffectiveMembership {
/// The id of the log that applies this membership config
pub log_id: LogId,

pub membership: Membership,
}

impl EffectiveMembership {
pub fn new(log_id: LogId, membership: Membership) -> Self {
Self { log_id, membership }
}
}
21 changes: 21 additions & 0 deletions rocksstore/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "rocksstore"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
openraft = { path = "../openraft" }

rocksdb = "0.20.1"
byteorder = "1.4.3"
serde = { version = "1.0.114", features = ["derive"] }
serde_json = "1.0.57"
async-std = { version = "1.12.0", features = ["attributes", "tokio1"] }
tracing = "0.1.29"

[dev-dependencies]
anyhow = "1.0.63"
async-trait = "*"
tempdir = "*"
Loading

0 comments on commit 9a22bb0

Please sign in to comment.