From 83704a06fabf947d8ebfc83ad70d45f084aefd0c Mon Sep 17 00:00:00 2001 From: Gyubong Date: Wed, 3 Jan 2024 14:51:17 +0900 Subject: [PATCH] Reconstruct project structure --- .gitignore | 2 +- Cargo.lock | 8 +-- Cargo.toml | 58 ++++++++----------- binding/python/Cargo.toml | 24 ++++---- examples/memstore/Cargo.toml | 14 +++-- harness/Cargo.toml | 14 +++-- raftify/Cargo.toml | 33 +++++++++++ build.rs => raftify/build.rs | 0 {proto => raftify/proto}/eraftpb.proto | 0 {proto => raftify/proto}/raft_service.proto | 0 {src => raftify/src}/cli/commands/debug.rs | 0 {src => raftify/src}/cli/commands/mod.rs | 0 {src => raftify/src}/cli/mod.rs | 0 {src => raftify/src}/config.rs | 0 {src => raftify/src}/deserializer.rs | 0 {src => raftify/src}/error.rs | 0 {src => raftify/src}/follower_role.rs | 0 {src => raftify/src}/lib.rs | 0 {src => raftify/src}/log_entry/mod.rs | 0 {src => raftify/src}/peer.rs | 0 {src => raftify/src}/peers.rs | 0 {src => raftify/src}/raft_client.rs | 0 {src => raftify/src}/raft_facade.rs | 0 {src => raftify/src}/raft_node/bootstrap.rs | 0 {src => raftify/src}/raft_node/mod.rs | 0 .../src}/raft_node/response_sender.rs | 0 {src => raftify/src}/raft_node/utils.rs | 0 {src => raftify/src}/raft_server.rs | 0 {src => raftify/src}/raft_service.rs | 0 {src => raftify/src}/request_message.rs | 0 {src => raftify/src}/response_message.rs | 0 {src => raftify/src}/state_machine/mod.rs | 0 {src => raftify/src}/storage/constant.rs | 0 {src => raftify/src}/storage/heed.rs | 0 {src => raftify/src}/storage/mod.rs | 0 {src => raftify/src}/storage/utils.rs | 0 {src => raftify/src}/utils.rs | 0 rust-toolchain | 1 + 38 files changed, 93 insertions(+), 61 deletions(-) create mode 100644 raftify/Cargo.toml rename build.rs => raftify/build.rs (100%) rename {proto => raftify/proto}/eraftpb.proto (100%) rename {proto => raftify/proto}/raft_service.proto (100%) rename {src => raftify/src}/cli/commands/debug.rs (100%) rename {src => raftify/src}/cli/commands/mod.rs (100%) rename {src => raftify/src}/cli/mod.rs (100%) rename {src => raftify/src}/config.rs (100%) rename {src => raftify/src}/deserializer.rs (100%) rename {src => raftify/src}/error.rs (100%) rename {src => raftify/src}/follower_role.rs (100%) rename {src => raftify/src}/lib.rs (100%) rename {src => raftify/src}/log_entry/mod.rs (100%) rename {src => raftify/src}/peer.rs (100%) rename {src => raftify/src}/peers.rs (100%) rename {src => raftify/src}/raft_client.rs (100%) rename {src => raftify/src}/raft_facade.rs (100%) rename {src => raftify/src}/raft_node/bootstrap.rs (100%) rename {src => raftify/src}/raft_node/mod.rs (100%) rename {src => raftify/src}/raft_node/response_sender.rs (100%) rename {src => raftify/src}/raft_node/utils.rs (100%) rename {src => raftify/src}/raft_server.rs (100%) rename {src => raftify/src}/raft_service.rs (100%) rename {src => raftify/src}/request_message.rs (100%) rename {src => raftify/src}/response_message.rs (100%) rename {src => raftify/src}/state_machine/mod.rs (100%) rename {src => raftify/src}/storage/constant.rs (100%) rename {src => raftify/src}/storage/heed.rs (100%) rename {src => raftify/src}/storage/mod.rs (100%) rename {src => raftify/src}/storage/utils.rs (100%) rename {src => raftify/src}/utils.rs (100%) create mode 100644 rust-toolchain diff --git a/.gitignore b/.gitignore index 0ff11e0c..51be0097 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -/target +target node-* logs diff --git a/Cargo.lock b/Cargo.lock index 52d4a346..10324226 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -939,7 +939,7 @@ dependencies = [ [[package]] name = "harness" -version = "0.1.0" +version = "0.1.2" dependencies = [ "actix-rt", "actix-web", @@ -1343,7 +1343,7 @@ dependencies = [ [[package]] name = "memstore" -version = "0.1.0" +version = "0.1.2" dependencies = [ "actix-rt", "actix-web", @@ -1825,7 +1825,7 @@ dependencies = [ [[package]] name = "raftify" -version = "0.1.0" +version = "0.1.2" dependencies = [ "async-trait", "bincode", @@ -1850,7 +1850,7 @@ dependencies = [ [[package]] name = "raftify-py" -version = "0.1.0" +version = "0.1.2" dependencies = [ "async-trait", "bincode", diff --git a/Cargo.toml b/Cargo.toml index b4cc3bdc..7a0cdd94 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,40 +1,30 @@ -[package] -name = "raftify" -version = "0.1.0" -authors = ["Lablup Inc."] -edition = "2021" -license = "MIT/Apache-2.0" -repository = "https://github.com/lablup/raftify" -description = "Experimental High level Raft framework" -keywords = ["raft", "distributed-systems", "ha"] - -[dependencies] -async-trait = "0.1.48" -bincode = "1.3" -bytes = "1.5.0" -heed = "0.20.0-alpha.9" -heed-traits = "0.20.0-alpha.9" -log = { version = "0.4", features = ["std"] } -parking_lot = "0.12.1" -prost = "0.11" -raft = { git = "https://github.com/jopemachine/raft-rs", features = ["prost-codec", "default-logger"], default-features = false } -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" -slog = "2" -slog-stdlog = "4" -thiserror = "1.0" -tokio = { version = "1.4", features = ["full"] } -tonic = "0.9.2" -built = "0.5" -clap = "3.0" - -[build-dependencies] -tonic-build = "0.9.2" -built = "0.5" - [workspace] +resolver = "2" members = [ + "raftify", "binding/python", "examples/memstore", "harness" ] +default-members = [ + "raftify", + "binding/python", + "examples/memstore", + "harness" +] + +[workspace.package] +version = "0.1.2" +authors = ["Lablup Inc."] +edition = "2021" +description = """ +Experimental High level Raft framework +""" +license = "MIT/Apache-2.0" +repository = "https://github.com/lablup/raftify" +keywords = ["raft", "distributed-systems", "ha"] +categories = ["distributed-systems", "database-implementations"] +homepage = "https://github.com/lablup/raftify" + +[workspace.dependencies] +raftify = { path = "raftify" } diff --git a/binding/python/Cargo.toml b/binding/python/Cargo.toml index d3fe9ab9..51fa51c8 100644 --- a/binding/python/Cargo.toml +++ b/binding/python/Cargo.toml @@ -1,27 +1,27 @@ [package] name = "raftify-py" -version = "0.1.0" -authors = ["Lablup Inc."] -license = "Apache-2.0" -repository = "https://github.com/lablup/raftify" + +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +keywords.workspace = true +categories.workspace = true +homepage.workspace = true +description.workspace = true readme = "./README.md" -homepage = "https://github.com/lablup/raftify" -description = """ -Experimental Async Raft framework for Python application -""" -keywords = ["raft", "distributed-systems", "consensus-algorithm", "replication", "distributed-database"] -categories = ["distributed-systems", "database-implementations"] -edition = "2021" [features] default = [] include-python-workspace = [] [dependencies] +raftify.workspace = true + pyo3 = { git = "https://github.com/jopemachine/pyo3", features = ["extension-module", "multiple-pymethods"] } tokio = { version = "1.4", features = ["full"] } async-trait = "0.1.48" -raftify = { path = "../../", default-features = false } slog = { version = "2.2", features = ["max_level_trace", "release_max_level_trace"] } slog-envlogger = "2.1.0" slog-term = "2.9.0" diff --git a/examples/memstore/Cargo.toml b/examples/memstore/Cargo.toml index 9ae1747d..6bee7cd2 100644 --- a/examples/memstore/Cargo.toml +++ b/examples/memstore/Cargo.toml @@ -1,9 +1,12 @@ [package] name = "memstore" -version = "0.1.0" -authors = ["Lablup Inc."] -edition = "2021" -description = "raftify memstore example" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +description.workspace = true +keywords.workspace = true [[bin]] name = "raftify-cli" @@ -14,12 +17,13 @@ name = "raftify-client-example" path = "src/client/main.rs" [dependencies] +raftify.workspace = true + actix-rt = "2.0" actix-web = "4.0.0" async-trait = "0.1.48" bincode = "1.3" log = { version = "0.4", features = ["std"] } -raftify = { path = "../../" } serde = { version = "1.0", features = ["derive"] } slog-async = "2" slog-term = "2" diff --git a/harness/Cargo.toml b/harness/Cargo.toml index f7719c08..e42bab7b 100644 --- a/harness/Cargo.toml +++ b/harness/Cargo.toml @@ -1,17 +1,21 @@ [package] name = "harness" -version = "0.1.0" -authors = ["Lablup Inc."] -description = "Testing harness for raftify." -edition = "2021" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +description.workspace = true +keywords.workspace = true [dependencies] +raftify.workspace = true + actix-rt = "2.0" actix-web = "4.0.0" async-trait = "0.1.48" bincode = "1.3" log = { version = "0.4", features = ["std"] } -raftify = { path = "../" } serde = { version = "1.0", features = ["derive"] } slog-async = "2" slog-term = "2" diff --git a/raftify/Cargo.toml b/raftify/Cargo.toml new file mode 100644 index 00000000..c1f7cb40 --- /dev/null +++ b/raftify/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "raftify" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +description.workspace = true +keywords.workspace = true + +[dependencies] +async-trait = "0.1.48" +bincode = "1.3" +bytes = "1.5.0" +heed = "0.20.0-alpha.9" +heed-traits = "0.20.0-alpha.9" +log = { version = "0.4", features = ["std"] } +parking_lot = "0.12.1" +prost = "0.11" +raft = { git = "https://github.com/jopemachine/raft-rs", features = ["prost-codec", "default-logger"], default-features = false } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +slog = "2" +slog-stdlog = "4" +thiserror = "1.0" +tokio = { version = "1.4", features = ["full"] } +tonic = "0.9.2" +built = "0.5" +clap = "3.0" + +[build-dependencies] +tonic-build = "0.9.2" +built = "0.5" diff --git a/build.rs b/raftify/build.rs similarity index 100% rename from build.rs rename to raftify/build.rs diff --git a/proto/eraftpb.proto b/raftify/proto/eraftpb.proto similarity index 100% rename from proto/eraftpb.proto rename to raftify/proto/eraftpb.proto diff --git a/proto/raft_service.proto b/raftify/proto/raft_service.proto similarity index 100% rename from proto/raft_service.proto rename to raftify/proto/raft_service.proto diff --git a/src/cli/commands/debug.rs b/raftify/src/cli/commands/debug.rs similarity index 100% rename from src/cli/commands/debug.rs rename to raftify/src/cli/commands/debug.rs diff --git a/src/cli/commands/mod.rs b/raftify/src/cli/commands/mod.rs similarity index 100% rename from src/cli/commands/mod.rs rename to raftify/src/cli/commands/mod.rs diff --git a/src/cli/mod.rs b/raftify/src/cli/mod.rs similarity index 100% rename from src/cli/mod.rs rename to raftify/src/cli/mod.rs diff --git a/src/config.rs b/raftify/src/config.rs similarity index 100% rename from src/config.rs rename to raftify/src/config.rs diff --git a/src/deserializer.rs b/raftify/src/deserializer.rs similarity index 100% rename from src/deserializer.rs rename to raftify/src/deserializer.rs diff --git a/src/error.rs b/raftify/src/error.rs similarity index 100% rename from src/error.rs rename to raftify/src/error.rs diff --git a/src/follower_role.rs b/raftify/src/follower_role.rs similarity index 100% rename from src/follower_role.rs rename to raftify/src/follower_role.rs diff --git a/src/lib.rs b/raftify/src/lib.rs similarity index 100% rename from src/lib.rs rename to raftify/src/lib.rs diff --git a/src/log_entry/mod.rs b/raftify/src/log_entry/mod.rs similarity index 100% rename from src/log_entry/mod.rs rename to raftify/src/log_entry/mod.rs diff --git a/src/peer.rs b/raftify/src/peer.rs similarity index 100% rename from src/peer.rs rename to raftify/src/peer.rs diff --git a/src/peers.rs b/raftify/src/peers.rs similarity index 100% rename from src/peers.rs rename to raftify/src/peers.rs diff --git a/src/raft_client.rs b/raftify/src/raft_client.rs similarity index 100% rename from src/raft_client.rs rename to raftify/src/raft_client.rs diff --git a/src/raft_facade.rs b/raftify/src/raft_facade.rs similarity index 100% rename from src/raft_facade.rs rename to raftify/src/raft_facade.rs diff --git a/src/raft_node/bootstrap.rs b/raftify/src/raft_node/bootstrap.rs similarity index 100% rename from src/raft_node/bootstrap.rs rename to raftify/src/raft_node/bootstrap.rs diff --git a/src/raft_node/mod.rs b/raftify/src/raft_node/mod.rs similarity index 100% rename from src/raft_node/mod.rs rename to raftify/src/raft_node/mod.rs diff --git a/src/raft_node/response_sender.rs b/raftify/src/raft_node/response_sender.rs similarity index 100% rename from src/raft_node/response_sender.rs rename to raftify/src/raft_node/response_sender.rs diff --git a/src/raft_node/utils.rs b/raftify/src/raft_node/utils.rs similarity index 100% rename from src/raft_node/utils.rs rename to raftify/src/raft_node/utils.rs diff --git a/src/raft_server.rs b/raftify/src/raft_server.rs similarity index 100% rename from src/raft_server.rs rename to raftify/src/raft_server.rs diff --git a/src/raft_service.rs b/raftify/src/raft_service.rs similarity index 100% rename from src/raft_service.rs rename to raftify/src/raft_service.rs diff --git a/src/request_message.rs b/raftify/src/request_message.rs similarity index 100% rename from src/request_message.rs rename to raftify/src/request_message.rs diff --git a/src/response_message.rs b/raftify/src/response_message.rs similarity index 100% rename from src/response_message.rs rename to raftify/src/response_message.rs diff --git a/src/state_machine/mod.rs b/raftify/src/state_machine/mod.rs similarity index 100% rename from src/state_machine/mod.rs rename to raftify/src/state_machine/mod.rs diff --git a/src/storage/constant.rs b/raftify/src/storage/constant.rs similarity index 100% rename from src/storage/constant.rs rename to raftify/src/storage/constant.rs diff --git a/src/storage/heed.rs b/raftify/src/storage/heed.rs similarity index 100% rename from src/storage/heed.rs rename to raftify/src/storage/heed.rs diff --git a/src/storage/mod.rs b/raftify/src/storage/mod.rs similarity index 100% rename from src/storage/mod.rs rename to raftify/src/storage/mod.rs diff --git a/src/storage/utils.rs b/raftify/src/storage/utils.rs similarity index 100% rename from src/storage/utils.rs rename to raftify/src/storage/utils.rs diff --git a/src/utils.rs b/raftify/src/utils.rs similarity index 100% rename from src/utils.rs rename to raftify/src/utils.rs diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 00000000..22d6771a --- /dev/null +++ b/rust-toolchain @@ -0,0 +1 @@ +1.72.1