diff --git a/Cargo.lock b/Cargo.lock index c467ca5..e0ce83d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1813,6 +1813,12 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + [[package]] name = "libc" version = "0.2.158" @@ -3876,12 +3882,6 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" -[[package]] -name = "unwrap-infallible" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" - [[package]] name = "unzip-n" version = "0.1.2" @@ -4351,7 +4351,7 @@ dependencies = [ [[package]] name = "zenoh" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "ahash", "async-trait", @@ -4378,7 +4378,6 @@ dependencies = [ "tokio-util", "tracing", "uhlc", - "unwrap-infallible", "vec_map", "zenoh-buffers", "zenoh-codec", @@ -4419,7 +4418,7 @@ dependencies = [ [[package]] name = "zenoh-buffers" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "zenoh-collections", ] @@ -4427,7 +4426,7 @@ dependencies = [ [[package]] name = "zenoh-codec" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "tracing", "uhlc", @@ -4438,12 +4437,12 @@ dependencies = [ [[package]] name = "zenoh-collections" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" [[package]] name = "zenoh-config" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "json5", "num_cpus", @@ -4464,7 +4463,7 @@ dependencies = [ [[package]] name = "zenoh-core" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "lazy_static", "tokio", @@ -4475,7 +4474,7 @@ dependencies = [ [[package]] name = "zenoh-crypto" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "aes 0.8.4", "hmac 0.12.1", @@ -4488,11 +4487,12 @@ dependencies = [ [[package]] name = "zenoh-ext" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "bincode", "flume", "futures", + "leb128", "serde", "tokio", "tracing", @@ -4504,7 +4504,7 @@ dependencies = [ [[package]] name = "zenoh-keyexpr" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "hashbrown 0.14.5", "keyed-set", @@ -4518,7 +4518,7 @@ dependencies = [ [[package]] name = "zenoh-link" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "zenoh-config", "zenoh-link-commons", @@ -4535,7 +4535,7 @@ dependencies = [ [[package]] name = "zenoh-link-commons" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "flume", @@ -4558,7 +4558,7 @@ dependencies = [ [[package]] name = "zenoh-link-quic" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "base64 0.22.1", @@ -4583,7 +4583,7 @@ dependencies = [ [[package]] name = "zenoh-link-tcp" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "socket2 0.5.7", @@ -4600,7 +4600,7 @@ dependencies = [ [[package]] name = "zenoh-link-tls" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "base64 0.22.1", @@ -4627,7 +4627,7 @@ dependencies = [ [[package]] name = "zenoh-link-udp" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "socket2 0.5.7", @@ -4646,7 +4646,7 @@ dependencies = [ [[package]] name = "zenoh-link-unixsock_stream" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "nix", @@ -4664,7 +4664,7 @@ dependencies = [ [[package]] name = "zenoh-link-ws" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "futures-util", @@ -4684,7 +4684,7 @@ dependencies = [ [[package]] name = "zenoh-macros" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "proc-macro2", "quote", @@ -4720,7 +4720,7 @@ dependencies = [ [[package]] name = "zenoh-plugin-rest" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "anyhow", "async-std", @@ -4745,7 +4745,7 @@ dependencies = [ [[package]] name = "zenoh-plugin-trait" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "git-version", "libloading", @@ -4761,7 +4761,7 @@ dependencies = [ [[package]] name = "zenoh-protocol" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "const_format", "rand 0.8.5", @@ -4775,7 +4775,7 @@ dependencies = [ [[package]] name = "zenoh-result" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "anyhow", ] @@ -4783,7 +4783,7 @@ dependencies = [ [[package]] name = "zenoh-runtime" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "lazy_static", "ron", @@ -4796,7 +4796,7 @@ dependencies = [ [[package]] name = "zenoh-sync" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "event-listener 5.3.1", "futures", @@ -4809,7 +4809,7 @@ dependencies = [ [[package]] name = "zenoh-task" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "futures", "tokio", @@ -4822,7 +4822,7 @@ dependencies = [ [[package]] name = "zenoh-transport" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "crossbeam-utils", @@ -4855,7 +4855,7 @@ dependencies = [ [[package]] name = "zenoh-util" version = "1.0.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#09d1d1d353b5fdc620ae61a925bd530676d34382" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#c040abdb12d1afccb90131d9a9712e38437426d7" dependencies = [ "async-trait", "const_format", diff --git a/zenoh-plugin-dds/src/lib.rs b/zenoh-plugin-dds/src/lib.rs index 64d3774..1392a37 100644 --- a/zenoh-plugin-dds/src/lib.rs +++ b/zenoh-plugin-dds/src/lib.rs @@ -12,7 +12,6 @@ // ZettaScale Zenoh Team, // use std::{ - borrow::Cow, collections::HashMap, env, future::Future, @@ -698,8 +697,9 @@ impl<'a> DdsPluginRuntime<'a> { // send replies for (ke, v) in kvs.drain(..) { let admin_keyexpr = admin_keyexpr_prefix / &ke; - match ZBytes::try_from(v) { - Ok(payload) => { + match serde_json::to_vec(&v) { + Ok(vec_u8) => { + let payload = ZBytes::from(vec_u8); if let Err(e) = query .reply(admin_keyexpr, payload) .encoding(Encoding::APPLICATION_JSON) @@ -708,9 +708,7 @@ impl<'a> DdsPluginRuntime<'a> { warn!("Error replying to admin query {:?}: {}", query, e); } } - Err(e) => { - warn!("Error transforming JSON to admin query {:?}: {}", query, e); - } + Err(e) => warn!("Error transforming JSON to admin query {:?}: {}", query, e), } } } @@ -1212,7 +1210,7 @@ impl<'a> DdsPluginRuntime<'a> { let full_admin_keyexpr = *KE_PREFIX_ADMIN_SPACE / remote_uuid / *KE_PREFIX_DDS / remaining_ke; if sample.kind() != SampleKind::Delete { // deserialize payload - let (entity, scope) = match bincode::deserialize::<(DdsEntity, Option)>(&sample.payload().into::>()) { + let (entity, scope) = match bincode::deserialize::<(DdsEntity, Option)>(&sample.payload().to_bytes()) { Ok(x) => x, Err(e) => { warn!("Failed to deserialize discovery msg for {}: {}", full_admin_keyexpr, e); @@ -1292,7 +1290,7 @@ impl<'a> DdsPluginRuntime<'a> { let full_admin_keyexpr = *KE_PREFIX_ADMIN_SPACE / remote_uuid / *KE_PREFIX_DDS / remaining_ke; if sample.kind() != SampleKind::Delete { // deserialize payload - let (entity, scope) = match bincode::deserialize::<(DdsEntity, Option)>(&sample.payload().into::>()) { + let (entity, scope) = match bincode::deserialize::<(DdsEntity, Option)>(&sample.payload().to_bytes()) { Ok(x) => x, Err(e) => { warn!("Failed to deserialize discovery msg for {}: {}", full_admin_keyexpr, e); diff --git a/zenoh-plugin-dds/src/route_zenoh_dds.rs b/zenoh-plugin-dds/src/route_zenoh_dds.rs index cd2f3b3..3663f5e 100644 --- a/zenoh-plugin-dds/src/route_zenoh_dds.rs +++ b/zenoh-plugin-dds/src/route_zenoh_dds.rs @@ -376,7 +376,7 @@ fn do_route_data(s: Sample, topic_name: &str, data_writer: dds_entity_t) { } unsafe { - let bs = s.payload().into(); + let bs = s.payload().to_bytes().to_vec(); // As per the Vec documentation (see https://doc.rust-lang.org/std/vec/struct.Vec.html#method.into_raw_parts) // the only way to correctly releasing it is to create a vec using from_raw_parts // and then have its destructor do the cleanup.