Update redis dependency.

This commit is contained in:
Orne Brocaar 2024-08-05 10:06:48 +01:00
parent 4e0106a4e8
commit 40a2b83bf5
11 changed files with 54 additions and 34 deletions

34
Cargo.lock generated
View File

@ -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",
]

View File

@ -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" }

View File

@ -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",
] }

View File

@ -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),
)?;

View File

@ -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

View File

@ -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;
}

View File

@ -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()
}

View File

@ -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 {

View File

@ -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(),

View File

@ -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 {

View File

@ -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