From 40a2b83bf561eefd633843e99a6fa46695029299 Mon Sep 17 00:00:00 2001 From: Orne Brocaar Date: Mon, 5 Aug 2024 10:06:48 +0100 Subject: [PATCH] Update redis dependency. --- Cargo.lock | 34 ++++++++++++++++++++-------- Cargo.toml | 4 ++++ chirpstack-integration/Cargo.toml | 2 +- chirpstack-integration/src/lib.rs | 16 ++++++------- chirpstack/Cargo.toml | 2 +- chirpstack/src/api/backend/mod.rs | 2 +- chirpstack/src/integration/redis.rs | 2 +- chirpstack/src/stream/api_request.rs | 2 +- chirpstack/src/stream/event.rs | 16 ++++++------- chirpstack/src/stream/frame.rs | 4 ++-- chirpstack/src/test/assert.rs | 4 ++-- 11 files changed, 54 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 662c9483..62cc0b0c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1230,7 +1230,17 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6541a3916932fe57768d4be0b1ffb5ec7cbf74ca8c903fdfd5c0fe8aa958f0ed" dependencies = [ - "deadpool-runtime", + "deadpool-runtime 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus", + "tokio", +] + +[[package]] +name = "deadpool" +version = "0.12.1" +source = "git+https://github.com/bikeshedder/deadpool.git?rev=6c361a306059bc8b0d3426515991e253015af6be#6c361a306059bc8b0d3426515991e253015af6be" +dependencies = [ + "deadpool-runtime 0.1.4 (git+https://github.com/bikeshedder/deadpool.git?rev=6c361a306059bc8b0d3426515991e253015af6be)", "num_cpus", "tokio", ] @@ -1238,10 +1248,9 @@ dependencies = [ [[package]] name = "deadpool-redis" version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff315fab2a7a42132352909afc81140d06b8bbfd1414b098ce278e3f95dd1b9" +source = "git+https://github.com/bikeshedder/deadpool.git?rev=6c361a306059bc8b0d3426515991e253015af6be#6c361a306059bc8b0d3426515991e253015af6be" dependencies = [ - "deadpool", + "deadpool 0.12.1 (git+https://github.com/bikeshedder/deadpool.git?rev=6c361a306059bc8b0d3426515991e253015af6be)", "redis", ] @@ -1250,6 +1259,11 @@ name = "deadpool-runtime" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "092966b41edc516079bdf31ec78a2e0588d1d0c08f78b91d8307215928642b2b" + +[[package]] +name = "deadpool-runtime" +version = "0.1.4" +source = "git+https://github.com/bikeshedder/deadpool.git?rev=6c361a306059bc8b0d3426515991e253015af6be#6c361a306059bc8b0d3426515991e253015af6be" dependencies = [ "tokio", ] @@ -1315,7 +1329,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb799bb6f8ca6a794462125d7b8983b0c86e6c93a33a9c55934a4a5de4409d3" dependencies = [ "async-trait", - "deadpool", + "deadpool 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "diesel", "futures-util", "scoped-futures", @@ -3493,10 +3507,11 @@ dependencies = [ [[package]] name = "redis" -version = "0.25.4" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0d7a6955c7511f60f3ba9e86c6d02b3c3f144f8c24b288d1f4e18074ab8bbec" +checksum = "e902a69d09078829137b4a5d9d082e0490393537badd7c91a3d69d14639e115f" dependencies = [ + "arc-swap", "async-trait", "bytes", "combine", @@ -3505,10 +3520,11 @@ dependencies = [ "futures-util", "itoa", "log", + "num-bigint", "percent-encoding", "pin-project-lite", "rand", - "rustls 0.22.4", + "rustls 0.23.12", "rustls-native-certs", "rustls-pemfile", "rustls-pki-types", @@ -3516,7 +3532,7 @@ dependencies = [ "sha1_smol", "socket2 0.5.7", "tokio", - "tokio-rustls 0.25.0", + "tokio-rustls 0.26.0", "tokio-util", "url", ] diff --git a/Cargo.toml b/Cargo.toml index 08c67276..ea7c0ddc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,3 +13,7 @@ opt-level = 'z' lto = true codegen-units = 1 + + +[patch.crates-io] + deadpool-redis = { git = "https://github.com/bikeshedder/deadpool.git", rev = "6c361a306059bc8b0d3426515991e253015af6be" } diff --git a/chirpstack-integration/Cargo.toml b/chirpstack-integration/Cargo.toml index f00ffad9..16cc442e 100644 --- a/chirpstack-integration/Cargo.toml +++ b/chirpstack-integration/Cargo.toml @@ -10,7 +10,7 @@ [dependencies] chirpstack_api = { path = "../api/rust", version = "4.9.0-test.1" } - redis = { version = "0.25", features = [ + redis = { version = "0.26", features = [ "cluster-async", "tokio-rustls-comp", ] } diff --git a/chirpstack-integration/src/lib.rs b/chirpstack-integration/src/lib.rs index ab91e499..f8eb2b67 100644 --- a/chirpstack-integration/src/lib.rs +++ b/chirpstack-integration/src/lib.rs @@ -215,7 +215,7 @@ impl Integration { info!(key = %k, "Event received from Redis stream"); match k.as_ref() { "up" => { - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = integration_pb::UplinkEvent::decode( &mut Cursor::new(b), )?; @@ -223,21 +223,21 @@ impl Integration { } } "join" => { - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = integration_pb::JoinEvent::decode(&mut Cursor::new(b))?; tokio::spawn(join_event(pl)); } } "ack" => { - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = integration_pb::AckEvent::decode(&mut Cursor::new(b))?; tokio::spawn(ack_event(pl)); } } "txack" => { - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = integration_pb::TxAckEvent::decode( &mut Cursor::new(b), )?; @@ -245,7 +245,7 @@ impl Integration { } } "status" => { - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = integration_pb::StatusEvent::decode( &mut Cursor::new(b), )?; @@ -253,14 +253,14 @@ impl Integration { } } "log" => { - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = integration_pb::LogEvent::decode(&mut Cursor::new(b))?; tokio::spawn(log_event(pl)); } } "location" => { - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = integration_pb::LocationEvent::decode( &mut Cursor::new(b), )?; @@ -268,7 +268,7 @@ impl Integration { } } "integration" => { - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = integration_pb::IntegrationEvent::decode( &mut Cursor::new(b), )?; diff --git a/chirpstack/Cargo.toml b/chirpstack/Cargo.toml index 5fae4b4b..523f81e3 100644 --- a/chirpstack/Cargo.toml +++ b/chirpstack/Cargo.toml @@ -41,7 +41,7 @@ tokio-postgres = "0.7" tokio-postgres-rustls = "0.12" bigdecimal = "0.4" - redis = { version = "0.25", features = ["tls-rustls", "tokio-rustls-comp"] } + redis = { version = "0.26", features = ["tls-rustls", "tokio-rustls-comp"] } deadpool-redis = { version = "0.15", features = ["cluster"] } # Logging diff --git a/chirpstack/src/api/backend/mod.rs b/chirpstack/src/api/backend/mod.rs index 9748cb72..ed716a31 100644 --- a/chirpstack/src/api/backend/mod.rs +++ b/chirpstack/src/api/backend/mod.rs @@ -658,7 +658,7 @@ pub async fn get_async_receiver( for (k, v) in &stream_id.map { match k.as_ref() { "pl" => { - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let _ = tx.send(b.to_vec()); return; } diff --git a/chirpstack/src/integration/redis.rs b/chirpstack/src/integration/redis.rs index b9088ecb..c0477841 100644 --- a/chirpstack/src/integration/redis.rs +++ b/chirpstack/src/integration/redis.rs @@ -254,7 +254,7 @@ pub mod test { let stream_id = &stream_key.ids[0]; let v = stream_id.map.get(event).unwrap(); - assert_eq!(&redis::Value::Data(b.to_vec()), v); + assert_eq!(&redis::Value::BulkString(b.to_vec()), v); stream_id.id.clone() } diff --git a/chirpstack/src/stream/api_request.rs b/chirpstack/src/stream/api_request.rs index 9d2275ad..77c929dc 100644 --- a/chirpstack/src/stream/api_request.rs +++ b/chirpstack/src/stream/api_request.rs @@ -62,7 +62,7 @@ mod tests { assert_eq!(1, srr.keys.len()); assert_eq!(1, srr.keys[0].ids.len()); - if let Some(redis::Value::Data(b)) = srr.keys[0].ids[0].map.get("request") { + if let Some(redis::Value::BulkString(b)) = srr.keys[0].ids[0].map.get("request") { let pl_recv = stream::ApiRequestLog::decode(&mut Cursor::new(b)).unwrap(); assert_eq!(pl, pl_recv); } else { diff --git a/chirpstack/src/stream/event.rs b/chirpstack/src/stream/event.rs index 3436d700..ff35e358 100644 --- a/chirpstack/src/stream/event.rs +++ b/chirpstack/src/stream/event.rs @@ -115,7 +115,7 @@ async fn handle_stream( match k { "up" => { trace!(key = %k, id = %stream_id, "Event-log received from stream"); - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = integration::UplinkEvent::decode(&mut Cursor::new(b))?; let pl = api::LogItem { id: stream_id.to_string(), @@ -141,7 +141,7 @@ async fn handle_stream( } "join" => { trace!(key = %k, id = %stream_id, "Event-log received from stream"); - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = integration::JoinEvent::decode(&mut Cursor::new(b))?; let pl = api::LogItem { id: stream_id.to_string(), @@ -162,7 +162,7 @@ async fn handle_stream( } "ack" => { trace!(key = %k, id = %stream_id, "Event-log received from stream"); - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = integration::AckEvent::decode(&mut Cursor::new(b))?; let pl = api::LogItem { id: stream_id.to_string(), @@ -180,7 +180,7 @@ async fn handle_stream( } "txack" => { trace!(key = %k, id = %stream_id, "Event-log received from stream"); - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = integration::TxAckEvent::decode(&mut Cursor::new(b))?; let pl = api::LogItem { id: stream_id.to_string(), @@ -198,7 +198,7 @@ async fn handle_stream( } "status" => { trace!(key = %k, id = %stream_id, "Event-log received from stream"); - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = integration::StatusEvent::decode(&mut Cursor::new(b))?; let pl = api::LogItem { id: stream_id.to_string(), @@ -230,7 +230,7 @@ async fn handle_stream( } "log" => { trace!(key = %k, id =%stream_id, "Event-log received from stream"); - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = integration::LogEvent::decode(&mut Cursor::new(b))?; let pl = api::LogItem { id: stream_id.to_string(), @@ -254,7 +254,7 @@ async fn handle_stream( } "location" => { trace!(key = %k, id=%stream_id, "Event-log received from stream"); - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = integration::LocationEvent::decode(&mut Cursor::new(b))?; let pl = api::LogItem { id: stream_id.to_string(), @@ -272,7 +272,7 @@ async fn handle_stream( } "integration" => { trace!(key = %k, id=%stream_id, "Event-log received from stream"); - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = integration::IntegrationEvent::decode(&mut Cursor::new(b))?; let pl = api::LogItem { id: stream_id.to_string(), diff --git a/chirpstack/src/stream/frame.rs b/chirpstack/src/stream/frame.rs index f902e276..2d925d56 100644 --- a/chirpstack/src/stream/frame.rs +++ b/chirpstack/src/stream/frame.rs @@ -279,7 +279,7 @@ async fn handle_stream( match k { "up" => { trace!(key = %k, id = %stream_id, "Frame-log received from stream"); - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = stream::UplinkFrameLog::decode(&mut Cursor::new(b))?; let mut phy = lrwn::PhyPayload::from_slice(&pl.phy_payload)?; if pl.plaintext_f_opts { @@ -320,7 +320,7 @@ async fn handle_stream( } "down" => { trace!(key = %k, id = %stream_id, "frame-log received from stream"); - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = stream::DownlinkFrameLog::decode(&mut Cursor::new(b))?; let mut phy = lrwn::PhyPayload::from_slice(&pl.phy_payload)?; if pl.plaintext_f_opts { diff --git a/chirpstack/src/test/assert.rs b/chirpstack/src/test/assert.rs index a6b78f29..0717bc70 100644 --- a/chirpstack/src/test/assert.rs +++ b/chirpstack/src/test/assert.rs @@ -422,7 +422,7 @@ pub fn uplink_meta_log(um: stream::UplinkMeta) -> Validator { for stream_id in &stream_key.ids { for (k, v) in &stream_id.map { assert_eq!("up", k); - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let pl = stream::UplinkMeta::decode(&mut Cursor::new(b)).unwrap(); assert_eq!(um, pl); } else { @@ -458,7 +458,7 @@ pub fn device_uplink_frame_log(uf: stream::UplinkFrameLog) -> Validator { for stream_id in &stream_key.ids { for (k, v) in &stream_id.map { assert_eq!("up", k); - if let redis::Value::Data(b) = v { + if let redis::Value::BulkString(b) = v { let mut pl = stream::UplinkFrameLog::decode(&mut Cursor::new(b)).unwrap(); pl.time = None; // we don't have control over this value