From 4b3d1f57ce30c33d172c7d46cc4c9b16b7f2f3ac Mon Sep 17 00:00:00 2001 From: Dino Wernli Date: Sat, 20 Apr 2024 16:33:42 +0200 Subject: [PATCH] Update a few project dependencies. --- Cargo.lock | 177 ++++++++++-------------------------------- Cargo.toml | 34 ++++---- src/raft/client.rs | 18 ++--- src/raft/consensus.rs | 2 +- src/testing/server.rs | 2 +- 5 files changed, 69 insertions(+), 164 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a8302e7..e5ef938 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -329,9 +329,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.13.1" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "bitflags" @@ -378,9 +378,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytes" -version = "0.5.6" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" +checksum = "e0dcbc35f504eb6fc275a6d20e4ebcda18cf50d40ba6fabff8c711fa16cb3b16" [[package]] name = "bytes" @@ -435,13 +435,13 @@ version = "0.1.0" dependencies = [ "async-std", "async-trait", - "bytes 0.5.6", + "bytes 0.6.0", "chrono", "futures", "im", "pin-project", "prost", - "rand 0.7.3", + "rand", "structopt", "timer", "tokio", @@ -688,17 +688,6 @@ dependencies = [ "slab", ] -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - [[package]] name = "getrandom" version = "0.2.14" @@ -707,7 +696,7 @@ checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -770,9 +759,9 @@ dependencies = [ [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" @@ -789,15 +778,6 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "http" version = "0.2.12" @@ -898,7 +878,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" dependencies = [ "bitmaps", - "rand_core 0.6.4", + "rand_core", "rand_xoshiro", "sized-chunks", "typenum", @@ -947,9 +927,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.5" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] @@ -1054,15 +1034,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys 0.48.0", ] [[package]] name = "multimap" -version = "0.8.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" [[package]] name = "nu-ansi-term" @@ -1218,12 +1198,12 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "prettyplease" -version = "0.1.25" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" +checksum = "5ac2cf0f2e4f42b49f5ffd07dae8d746508ef7526c13940e5f524012ae6c6550" dependencies = [ "proc-macro2", - "syn 1.0.109", + "syn 2.0.60", ] [[package]] @@ -1261,9 +1241,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.9" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" dependencies = [ "bytes 1.6.0", "prost-derive", @@ -1271,44 +1251,43 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.9" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" +checksum = "80b776a1b2dc779f5ee0641f8ade0125bc1298dd41a9a0c16d8bd57b42d222b1" dependencies = [ "bytes 1.6.0", - "heck 0.4.1", + "heck 0.5.0", "itertools", - "lazy_static", "log", "multimap", + "once_cell", "petgraph", "prettyplease", "prost", "prost-types", "regex", - "syn 1.0.109", + "syn 2.0.60", "tempfile", - "which", ] [[package]] name = "prost-derive" -version = "0.11.9" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +checksum = "19de2de2a00075bf566bee3bd4db014b11587e84184d3f7a791bc17f1a8e9e48" dependencies = [ "anyhow", "itertools", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.60", ] [[package]] name = "prost-types" -version = "0.11.9" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" +checksum = "3235c33eb02c1f1e212abdbe34c78b264b038fb58ca612664343271e36e55ffe" dependencies = [ "prost", ] @@ -1322,19 +1301,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", -] - [[package]] name = "rand" version = "0.8.5" @@ -1342,18 +1308,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "rand_chacha", + "rand_core", ] [[package]] @@ -1363,16 +1319,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", + "rand_core", ] [[package]] @@ -1381,16 +1328,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.14", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", + "getrandom", ] [[package]] @@ -1399,7 +1337,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" dependencies = [ - "rand_core 0.6.4", + "rand_core", ] [[package]] @@ -1722,17 +1660,15 @@ dependencies = [ [[package]] name = "tonic" -version = "0.8.3" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb" +checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" dependencies = [ "async-stream", "async-trait", "axum", "base64", "bytes 1.6.0", - "futures-core", - "futures-util", "h2", "http", "http-body", @@ -1741,28 +1677,25 @@ dependencies = [ "percent-encoding", "pin-project", "prost", - "prost-derive", "tokio", "tokio-stream", - "tokio-util", "tower", "tower-layer", "tower-service", "tracing", - "tracing-futures", ] [[package]] name = "tonic-build" -version = "0.8.4" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf5e9b9c0f7e0a7c027dcfaba7b2c60816c7049171f679d99ee2ff65d0de8c4" +checksum = "be4ef6dd70a610078cb4e338a0f79d06bc759ff1b22d2120c2ff02ae264ba9c2" dependencies = [ "prettyplease", "proc-macro2", "prost-build", "quote", - "syn 1.0.109", + "syn 2.0.60", ] [[package]] @@ -1776,7 +1709,7 @@ dependencies = [ "indexmap 1.9.3", "pin-project", "pin-project-lite", - "rand 0.8.5", + "rand", "slab", "tokio", "tokio-util", @@ -1830,16 +1763,6 @@ dependencies = [ "valuable", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project", - "tracing", -] - [[package]] name = "tracing-log" version = "0.2.0" @@ -1938,12 +1861,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2026,18 +1943,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix 0.38.32", -] - [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 8c5ea81..f04903c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,26 +2,26 @@ name = "concord" version = "0.1.0" authors = ["Dino Wernli "] -edition = "2018" +edition = "2021" [dependencies] -async-std = {version = "1.9.0", features = ["attributes"]} -async-trait = "0.1.51" -bytes = "0.5.6" -chrono = "0.4.23" -futures = "0.3.5" -im = "15.0.0" -prost = "0.11" -rand = "0.7.3" -structopt = "0.3.25" -timer = "0.2.0" -tokio = { version = "1.21", features = ["macros", "rt-multi-thread"] } -tokio-stream = { version = "0.1.11", features = ["net"] } -tonic = "0.8.1" -tracing = "0.1.29" +async-std = {version = "1.12", features = ["attributes"]} +async-trait = "0.1.80" +bytes = "0.6" +chrono = "0.4" +futures = "0.3" +im = "15" +prost = "0.12" +rand = "0.8" +structopt = "0.3" +timer = "0.2" +tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } +tokio-stream = { version = "0.1.15", features = ["net"] } +tonic = "0.11" +tracing = "0.1.40" tracing-subscriber = {version = "0.3.1", features = ["env-filter"]} tower = "0.4.13" -pin-project = "1.0.12" +pin-project = "1.1" [build-dependencies] -tonic-build = "0.8.1" +tonic-build = "0.11" diff --git a/src/raft/client.rs b/src/raft/client.rs index d7e9bc3..2c35aac 100644 --- a/src/raft/client.rs +++ b/src/raft/client.rs @@ -139,9 +139,9 @@ impl ClientImpl { Err(status) => return Failure(tonic::Status::internal(status.to_string())), Ok(response) => { let proto: CommitResponse = response.into_inner(); - match Status::from_i32(proto.status) { - Some(Status::Success) => Success(proto.entry_id.expect("entryid")), - Some(Status::NotLeader) => NewLeader(proto.leader), + match Status::try_from(proto.status) { + Ok(Status::Success) => Success(proto.entry_id.expect("entryid")), + Ok(Status::NotLeader) => NewLeader(proto.leader), _ => Failure(bad_status(proto.status)), } } @@ -163,9 +163,9 @@ impl ClientImpl { Err(status) => return Failure(tonic::Status::internal(status.to_string())), Ok(response) => { let proto: StepDownResponse = response.into_inner(); - match Status::from_i32(proto.status) { - Some(Status::Success) => Success(proto.leader.expect("leader")), - Some(Status::NotLeader) => NewLeader(proto.leader), + match Status::try_from(proto.status) { + Ok(Status::Success) => Success(proto.leader.expect("leader")), + Ok(Status::NotLeader) => NewLeader(proto.leader), _ => Failure(bad_status(proto.status)), } } @@ -188,9 +188,9 @@ impl ClientImpl { Err(status) => return Failure(tonic::Status::internal(status.to_string())), Ok(response) => { let proto: ChangeConfigResponse = response.into_inner(); - match Status::from_i32(proto.status) { - Some(Status::Success) => Success(()), - Some(Status::NotLeader) => NewLeader(proto.leader), + match Status::try_from(proto.status) { + Ok(Status::Success) => Success(()), + Ok(Status::NotLeader) => NewLeader(proto.leader), _ => Failure(bad_status(proto.status)), } } diff --git a/src/raft/consensus.rs b/src/raft/consensus.rs index 48b4d69..1994d21 100644 --- a/src/raft/consensus.rs +++ b/src/raft/consensus.rs @@ -1027,7 +1027,7 @@ impl Raft for RaftImpl { fn add_jitter(lower: i64) -> u64 { let mut rng = rand::thread_rng(); let upper = (lower as f64 * 1.3) as i64; - rng.gen_range(lower, upper) as u64 + rng.gen_range(lower..upper) as u64 } #[cfg(test)] diff --git a/src/testing/server.rs b/src/testing/server.rs index 8a1b2d8..dd6d439 100644 --- a/src/testing/server.rs +++ b/src/testing/server.rs @@ -9,7 +9,7 @@ use tonic::body::BoxBody; use tonic::codegen::http::{Request, Response}; use tonic::codegen::Service; use tonic::transport::Body; -use tonic::transport::NamedService; +use tonic::server::NamedService; // A helper struct which can be used to test grpc services. Runs a real server // which binds to an arbitrary port and provides access to the resulting port.