From ba004d3f2322e776c875dce67da23a215ede5bce Mon Sep 17 00:00:00 2001 From: ChenYing Kuo Date: Mon, 17 Jun 2024 11:48:14 +0800 Subject: [PATCH] Migrate to Zenoh 1.0 Signed-off-by: ChenYing Kuo --- Cargo.lock | 438 +++++++++++++++--------- Cargo.toml | 16 +- zenoh-bridge-dds/src/main.rs | 10 +- zenoh-plugin-dds/src/config.rs | 2 +- zenoh-plugin-dds/src/dds_mgt.rs | 19 +- zenoh-plugin-dds/src/lib.rs | 101 +++--- zenoh-plugin-dds/src/route_dds_zenoh.rs | 17 +- zenoh-plugin-dds/src/route_zenoh_dds.rs | 31 +- 8 files changed, 370 insertions(+), 264 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5f7cbbd0..3e716675 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -357,7 +357,7 @@ checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.66", ] [[package]] @@ -456,7 +456,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.33", + "syn 2.0.66", "which", ] @@ -587,12 +587,6 @@ dependencies = [ "serde", ] -[[package]] -name = "cesu8" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" - [[package]] name = "cexpr" version = "0.6.0" @@ -692,16 +686,6 @@ dependencies = [ "cc", ] -[[package]] -name = "combine" -version = "4.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" -dependencies = [ - "bytes", - "memchr", -] - [[package]] name = "concurrent-queue" version = "2.2.0" @@ -1146,7 +1130,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.66", ] [[package]] @@ -1269,6 +1253,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "half" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" + [[package]] name = "hashbrown" version = "0.12.3" @@ -1527,30 +1517,16 @@ dependencies = [ ] [[package]] -name = "itoa" -version = "1.0.9" +name = "iter-read" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "c397ca3ea05ad509c4ec451fea28b4771236a376ca1c69fd5143aae0cf8f93c4" [[package]] -name = "jni" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" -dependencies = [ - "cesu8", - "combine", - "jni-sys", - "log", - "thiserror", - "walkdir", -] - -[[package]] -name = "jni-sys" -version = "0.3.0" +name = "itoa" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" @@ -2043,7 +2019,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.66", ] [[package]] @@ -2067,6 +2043,48 @@ dependencies = [ "indexmap 2.0.0", ] +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_macros", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared", + "rand 0.8.5", +] + +[[package]] +name = "phf_macros" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project" version = "1.1.3" @@ -2084,7 +2102,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.66", ] [[package]] @@ -2198,7 +2216,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", - "syn 2.0.33", + "syn 2.0.66", ] [[package]] @@ -2209,25 +2227,25 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" dependencies = [ "unicode-ident", ] [[package]] name = "quinn" -version = "0.11.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904e3d3ba178131798c6d9375db2b13b34337d489b089fc5ba0825a2ff1bee73" +checksum = "8cc2c5017e4b43d5995dcea317bc46c1e09404c0a9664d2908f7f02dfe943d75" dependencies = [ "bytes", "pin-project-lite 0.2.13", "quinn-proto", "quinn-udp", "rustc-hash", - "rustls", + "rustls 0.21.12", "thiserror", "tokio", "tracing", @@ -2235,16 +2253,16 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.11.2" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e974563a4b1c2206bbc61191ca4da9c22e4308b4c455e8906751cc7828393f08" +checksum = "141bf7dfde2fbc246bfd3fe12f2455aa24b0fbd9af535d8c86c7bd1381ff2b1a" dependencies = [ "bytes", "rand 0.8.5", - "ring", + "ring 0.16.20", "rustc-hash", - "rustls", - "rustls-platform-verifier", + "rustls 0.21.12", + "rustls-native-certs 0.6.3", "slab", "thiserror", "tinyvec", @@ -2253,22 +2271,22 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.1" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4f0def2590301f4f667db5a77f9694fb004f82796dc1a8b1508fafa3d0e8b72" +checksum = "055b4e778e8feb9f93c4e439f71dc2156ef13360b432b799e179a8c4cdf0b1d7" dependencies = [ + "bytes", "libc", - "once_cell", "socket2 0.5.6", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -2417,6 +2435,21 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin 0.5.2", + "untrusted 0.7.1", + "web-sys", + "winapi", +] + [[package]] name = "ring" version = "0.17.6" @@ -2427,7 +2460,7 @@ dependencies = [ "getrandom 0.2.10", "libc", "spin 0.9.8", - "untrusted", + "untrusted 0.9.0", "windows-sys 0.48.0", ] @@ -2540,19 +2573,42 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.9" +version = "0.21.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a218f0f6d05669de4eabfb24f31ce802035c952429d037507b4a4a39f0e60c5b" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", - "once_cell", - "ring", + "ring 0.17.6", + "rustls-webpki 0.101.7", + "sct", +] + +[[package]] +name = "rustls" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +dependencies = [ + "log", + "ring 0.17.6", "rustls-pki-types", - "rustls-webpki", + "rustls-webpki 0.102.4", "subtle", "zeroize", ] +[[package]] +name = "rustls-native-certs" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +dependencies = [ + "openssl-probe", + "rustls-pemfile 1.0.4", + "schannel", + "security-framework", +] + [[package]] name = "rustls-native-certs" version = "0.7.0" @@ -2560,12 +2616,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" dependencies = [ "openssl-probe", - "rustls-pemfile", + "rustls-pemfile 2.0.0", "rustls-pki-types", "schannel", "security-framework", ] +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.4", +] + [[package]] name = "rustls-pemfile" version = "2.0.0" @@ -2583,41 +2648,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] -name = "rustls-platform-verifier" -version = "0.3.1" +name = "rustls-webpki" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5f0d26fa1ce3c790f9590868f0109289a044acb954525f933e2aa3b871c157d" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "core-foundation", - "core-foundation-sys", - "jni", - "log", - "once_cell", - "rustls", - "rustls-native-certs", - "rustls-platform-verifier-android", - "rustls-webpki", - "security-framework", - "security-framework-sys", - "webpki-roots", - "winapi", + "ring 0.17.6", + "untrusted 0.9.0", ] -[[package]] -name = "rustls-platform-verifier-android" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84e217e7fdc8466b5b35d30f8c0a30febd29173df4a3a0c2115d306b9c4117ad" - [[package]] name = "rustls-webpki" version = "0.102.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" dependencies = [ - "ring", + "ring 0.17.6", "rustls-pki-types", - "untrusted", + "untrusted 0.9.0", ] [[package]] @@ -2626,15 +2674,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - [[package]] name = "schannel" version = "0.1.22" @@ -2674,6 +2713,16 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring 0.17.6", + "untrusted 0.9.0", +] + [[package]] name = "secrecy" version = "0.8.0" @@ -2694,7 +2743,6 @@ dependencies = [ "core-foundation", "core-foundation-sys", "libc", - "num-bigint", "security-framework-sys", ] @@ -2731,22 +2779,45 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] +[[package]] +name = "serde-pickle" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c762ad136a26407c6a80825813600ceeab5e613660d93d79a41f0ec877171e71" +dependencies = [ + "byteorder", + "iter-read", + "num-bigint", + "num-traits", + "serde", +] + +[[package]] +name = "serde_cbor" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" +dependencies = [ + "half", + "serde", +] + [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.66", ] [[package]] @@ -2771,9 +2842,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -2938,6 +3009,12 @@ dependencies = [ "event-listener 2.5.3", ] +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + [[package]] name = "slab" version = "0.4.9" @@ -3167,9 +3244,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.33" +version = "2.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9caece70c63bfba29ec2fed841a09851b14a235c60010fa4de58089b6c025668" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" dependencies = [ "proc-macro2", "quote", @@ -3208,7 +3285,7 @@ checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.66", ] [[package]] @@ -3358,16 +3435,26 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.66", ] [[package]] name = "tokio-rustls" -version = "0.26.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls", + "rustls 0.21.12", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls 0.22.4", "rustls-pki-types", "tokio", ] @@ -3420,7 +3507,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.66", ] [[package]] @@ -3573,12 +3660,24 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "untrusted" 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" @@ -3701,16 +3800,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" -[[package]] -name = "walkdir" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -3746,7 +3835,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.66", "wasm-bindgen-shared", ] @@ -3780,7 +3869,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.66", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3997,7 +4086,7 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "zenoh" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "ahash", "async-trait", @@ -4012,17 +4101,22 @@ dependencies = [ "ordered-float", "paste", "petgraph", + "phf", "rand 0.8.5", "regex", "rustc_version 0.4.0", "serde", + "serde-pickle", + "serde_cbor", "serde_json", + "serde_yaml", "socket2 0.5.6", "stop-token", "tokio", "tokio-util", "tracing", "uhlc", + "unwrap-infallible", "uuid", "vec_map", "zenoh-buffers", @@ -4064,7 +4158,7 @@ dependencies = [ [[package]] name = "zenoh-buffers" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "zenoh-collections", ] @@ -4072,7 +4166,7 @@ dependencies = [ [[package]] name = "zenoh-codec" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "serde", "tracing", @@ -4084,12 +4178,12 @@ dependencies = [ [[package]] name = "zenoh-collections" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" [[package]] name = "zenoh-config" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "flume", "json5", @@ -4099,6 +4193,7 @@ dependencies = [ "serde_json", "serde_yaml", "tracing", + "uhlc", "validated_struct", "zenoh-core", "zenoh-protocol", @@ -4109,7 +4204,7 @@ dependencies = [ [[package]] name = "zenoh-core" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "async-global-executor", "lazy_static", @@ -4121,7 +4216,7 @@ dependencies = [ [[package]] name = "zenoh-crypto" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "aes 0.8.3", "hmac 0.12.1", @@ -4134,28 +4229,26 @@ dependencies = [ [[package]] name = "zenoh-ext" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "bincode", "flume", "futures", + "phf", "serde", + "serde_cbor", + "serde_json", "tokio", "tracing", "zenoh", - "zenoh-core", "zenoh-macros", - "zenoh-result", - "zenoh-runtime", - "zenoh-sync", - "zenoh-task", "zenoh-util", ] [[package]] name = "zenoh-keyexpr" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "hashbrown 0.14.0", "keyed-set", @@ -4169,7 +4262,7 @@ dependencies = [ [[package]] name = "zenoh-link" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "async-trait", "zenoh-config", @@ -4187,13 +4280,13 @@ dependencies = [ [[package]] name = "zenoh-link-commons" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "async-trait", "flume", "futures", - "rustls", - "rustls-webpki", + "rustls 0.22.4", + "rustls-webpki 0.102.4", "serde", "tokio", "tokio-util", @@ -4211,22 +4304,24 @@ dependencies = [ [[package]] name = "zenoh-link-quic" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "async-trait", "base64 0.21.4", "futures", "quinn", - "rustls", - "rustls-pemfile", + "rustls 0.21.12", + "rustls-native-certs 0.7.0", + "rustls-pemfile 1.0.4", "rustls-pki-types", - "rustls-webpki", + "rustls-webpki 0.102.4", "secrecy", "tokio", - "tokio-rustls", + "tokio-rustls 0.24.1", "tokio-util", "tracing", "webpki-roots", + "zenoh-collections", "zenoh-config", "zenoh-core", "zenoh-link-commons", @@ -4240,7 +4335,7 @@ dependencies = [ [[package]] name = "zenoh-link-tcp" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "async-trait", "tokio", @@ -4258,21 +4353,22 @@ dependencies = [ [[package]] name = "zenoh-link-tls" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "async-trait", "base64 0.21.4", "futures", - "rustls", - "rustls-pemfile", + "rustls 0.22.4", + "rustls-pemfile 2.0.0", "rustls-pki-types", - "rustls-webpki", + "rustls-webpki 0.102.4", "secrecy", "tokio", - "tokio-rustls", + "tokio-rustls 0.25.0", "tokio-util", "tracing", "webpki-roots", + "zenoh-collections", "zenoh-config", "zenoh-core", "zenoh-link-commons", @@ -4286,7 +4382,7 @@ dependencies = [ [[package]] name = "zenoh-link-udp" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "async-trait", "socket2 0.5.6", @@ -4307,7 +4403,7 @@ dependencies = [ [[package]] name = "zenoh-link-unixsock_stream" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "async-trait", "futures", @@ -4327,7 +4423,7 @@ dependencies = [ [[package]] name = "zenoh-link-ws" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "async-trait", "futures-util", @@ -4348,11 +4444,11 @@ dependencies = [ [[package]] name = "zenoh-macros" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.66", "zenoh-keyexpr", ] @@ -4387,7 +4483,7 @@ dependencies = [ [[package]] name = "zenoh-plugin-rest" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "anyhow", "async-std", @@ -4414,7 +4510,7 @@ dependencies = [ [[package]] name = "zenoh-plugin-trait" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "const_format", "libloading", @@ -4430,13 +4526,14 @@ dependencies = [ [[package]] name = "zenoh-protocol" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "const_format", "rand 0.8.5", "serde", "uhlc", "zenoh-buffers", + "zenoh-collections", "zenoh-keyexpr", "zenoh-result", ] @@ -4444,7 +4541,7 @@ dependencies = [ [[package]] name = "zenoh-result" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "anyhow", ] @@ -4452,7 +4549,7 @@ dependencies = [ [[package]] name = "zenoh-runtime" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "futures", "lazy_static", @@ -4460,7 +4557,6 @@ dependencies = [ "ron", "serde", "tokio", - "zenoh-collections", "zenoh-macros", "zenoh-result", ] @@ -4468,7 +4564,7 @@ dependencies = [ [[package]] name = "zenoh-sync" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "event-listener 4.0.0", "futures", @@ -4482,7 +4578,7 @@ dependencies = [ [[package]] name = "zenoh-task" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "futures", "tokio", @@ -4495,7 +4591,7 @@ dependencies = [ [[package]] name = "zenoh-transport" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "async-trait", "flume", @@ -4527,7 +4623,7 @@ dependencies = [ [[package]] name = "zenoh-util" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7adad9482f8d27fab56ca54aa053de4cc2f63557" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#5bff744b83e58eb1c6d65d8894d69f806455265e" dependencies = [ "async-std", "async-trait", @@ -4564,7 +4660,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.66", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index d80a8304..2520a886 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,21 +45,21 @@ lazy_static = "1.4.0" regex = "1.7.1" rustc_version = "0.4" serde = "1.0.154" -serde_json = "1.0.94" +serde_json = "1.0.114" tracing = "0.1" -zenoh = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = [ +zenoh = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "dev/1.0.0", features = [ "plugins", "unstable", ] } -zenoh-collections = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" } -zenoh-core = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" } -zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = [ +zenoh-collections = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "dev/1.0.0" } +zenoh-core = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "dev/1.0.0" } +zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "dev/1.0.0", features = [ "unstable", ] } zenoh-plugin-dds = { version = "0.11.0-dev", path = "zenoh-plugin-dds/", default-features = false } -zenoh-plugin-rest = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", default-features = false } -zenoh-plugin-trait = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", default-features = false } -zenoh-util = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", default-features = false } +zenoh-plugin-rest = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "dev/1.0.0", default-features = false } +zenoh-plugin-trait = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "dev/1.0.0", default-features = false } +zenoh-util = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "dev/1.0.0", default-features = false } [profile.release] codegen-units = 1 diff --git a/zenoh-bridge-dds/src/main.rs b/zenoh-bridge-dds/src/main.rs index bda07b3a..761eb0fa 100644 --- a/zenoh-bridge-dds/src/main.rs +++ b/zenoh-bridge-dds/src/main.rs @@ -15,10 +15,12 @@ use async_liveliness_monitor::LivelinessMonitor; use clap::{App, Arg}; use std::str::FromStr; use std::time::{Duration, SystemTime}; -use zenoh::config::{Config, ModeDependentValue}; -use zenoh::plugins::PluginsManager; -use zenoh::prelude::r#async::*; -use zenoh::runtime::RuntimeBuilder; +use zenoh::{ + config::{Config, ModeDependentValue}, + info::ZenohId, + internal::{plugins::PluginsManager, runtime::RuntimeBuilder}, + prelude::*, +}; use zenoh_plugin_dds::DDSPlugin; use zenoh_plugin_trait::Plugin; diff --git a/zenoh-plugin-dds/src/config.rs b/zenoh-plugin-dds/src/config.rs index 5672172d..265f6e8a 100644 --- a/zenoh-plugin-dds/src/config.rs +++ b/zenoh-plugin-dds/src/config.rs @@ -17,7 +17,7 @@ use serde::{de, Deserialize, Deserializer}; use std::env; use std::fmt; use std::time::Duration; -use zenoh::prelude::*; +use zenoh::key_expr::OwnedKeyExpr; pub const DEFAULT_DOMAIN: u32 = 0; pub const DEFAULT_FORWARD_DISCOVERY: bool = false; diff --git a/zenoh-plugin-dds/src/dds_mgt.rs b/zenoh-plugin-dds/src/dds_mgt.rs index 1680aa3a..c64eb2f9 100644 --- a/zenoh-plugin-dds/src/dds_mgt.rs +++ b/zenoh-plugin-dds/src/dds_mgt.rs @@ -25,11 +25,14 @@ use std::sync::Arc; use std::time::Duration; use tracing::{debug, error, warn}; #[cfg(feature = "dds_shm")] -use zenoh::buffers::{ZBuf, ZSlice}; -use zenoh::prelude::*; -use zenoh::publication::CongestionControl; -use zenoh::Session; -use zenoh_core::SyncResolve; +use zenoh::internal::buffers::{ZBuf, ZSlice}; +use zenoh::{ + bytes::ZBytes, + key_expr::{KeyExpr, OwnedKeyExpr}, + prelude::*, + publisher::CongestionControl, + Session, +}; const MAX_SAMPLES: usize = 32; @@ -264,7 +267,7 @@ impl fmt::Debug for DDSRawSample { } } -impl From for Value { +impl From for ZBytes { fn from(buf: DDSRawSample) -> Self { #[cfg(feature = "dds_shm")] { @@ -506,7 +509,7 @@ unsafe extern "C" fn data_forwarder_listener(dr: dds_entity_t, arg: *mut std::os .2 .put(&(*pa).1, raw_sample) .congestion_control((*pa).3) - .res_sync(); + .wait(); } ddsi_serdata_unref(zp); } @@ -603,7 +606,7 @@ pub(crate) fn create_forwarding_dds_reader( let _ = z .put(&z_key, raw_sample) .congestion_control(congestion_ctrl) - .res_sync(); + .wait(); } ddsi_serdata_unref(zp); } diff --git a/zenoh-plugin-dds/src/lib.rs b/zenoh-plugin-dds/src/lib.rs index 03829dd8..d78ec185 100644 --- a/zenoh-plugin-dds/src/lib.rs +++ b/zenoh-plugin-dds/src/lib.rs @@ -31,17 +31,22 @@ use std::sync::atomic::AtomicBool; use std::sync::Arc; use std::time::Duration; use tracing::{debug, error, info, trace, warn}; -use zenoh::liveliness::LivelinessToken; -use zenoh::plugins::{RunningPlugin, RunningPluginTrait, ZenohPlugin}; -use zenoh::prelude::r#async::AsyncResolve; -use zenoh::prelude::r#sync::SyncResolve; -use zenoh::prelude::*; -use zenoh::publication::CongestionControl; -use zenoh::query::{ConsolidationMode, QueryTarget}; -use zenoh::queryable::{Query, Queryable}; -use zenoh::runtime::Runtime; -use zenoh::Result as ZResult; -use zenoh::Session; +use zenoh::{ + bytes::ZBytes, + internal::{ + plugins::{RunningPlugin, RunningPluginTrait, ZenohPlugin}, + runtime::Runtime, + }, + key_expr::{keyexpr, KeyExpr, OwnedKeyExpr}, + liveliness::LivelinessToken, + prelude::*, + publisher::CongestionControl, + query::{ConsolidationMode, Query, QueryTarget}, + queryable::Queryable, + sample::{Locality, Sample, SampleKind}, + selector::Selector, + Result as ZResult, Session, +}; use zenoh_core::zerror; use zenoh_ext::{SessionExt, SubscriberBuilderExt}; use zenoh_plugin_trait::{plugin_long_version, plugin_version, Plugin, PluginControl}; @@ -70,7 +75,7 @@ macro_rules! ke_for_sure { macro_rules! member_id { ($val:expr) => { - $val.key_expr.as_str().split('/').last().unwrap() + $val.key_expr().as_str().split('/').last().unwrap() }; } @@ -156,10 +161,9 @@ pub async fn run(runtime: Runtime, config: Config) { debug!("DDS plugin {:?}", config); // open zenoh-net Session - let zsession = match zenoh::init(runtime) + let zsession = match zenoh::session::init(runtime) .aggregated_subscribers(config.generalise_subs.clone()) .aggregated_publishers(config.generalise_pubs.clone()) - .res_async() .await { Ok(session) => Arc::new(session), @@ -170,14 +174,14 @@ pub async fn run(runtime: Runtime, config: Config) { }; // create group member using the group_member_id if configured, or the Session ID otherwise + // TODO: Wait for the PR: https://github.com/eclipse-zenoh/zenoh/pull/1149 let member_id = match config.group_member_id { Some(ref id) => id.clone(), - None => zsession.zid().into_keyexpr(), + None => zsession.zid().to_string().try_into().unwrap(), }; let member = match zsession .liveliness() .declare_token(*KE_PREFIX_LIVELINESS_GROUP / &member_id) - .res_async() .await { Ok(member) => member, @@ -667,12 +671,15 @@ impl<'a> DdsPluginRuntime<'a> { // send replies for (ke, v) in kvs.drain(..) { let admin_keyexpr = admin_keyexpr_prefix / &ke; - if let Err(e) = query - .reply(Ok(Sample::new(admin_keyexpr, v))) - .res_async() - .await - { - warn!("Error replying to admin query {:?}: {}", query, e); + match TryInto::::try_into(v) { + Ok(payload) => { + if let Err(e) = query.reply(admin_keyexpr, payload).await { + warn!("Error replying to admin query {:?}: {}", query, e); + } + } + Err(e) => { + warn!("Error transforming JSON to admin query {:?}: {}", query, e); + } } } } @@ -684,7 +691,6 @@ impl<'a> DdsPluginRuntime<'a> { .declare_subscriber(*KE_PREFIX_LIVELINESS_GROUP / *KE_ANY_N_SEGMENT) .querying() .with(flume::unbounded()) - .res_async() .await .expect("Failed to create Liveliness Subscriber"); @@ -693,13 +699,14 @@ impl<'a> DdsPluginRuntime<'a> { run_discovery(self.dp, tx); // declare admin space queryable - let admin_keyexpr_prefix = *KE_PREFIX_ADMIN_SPACE / &self.zsession.zid().into_keyexpr(); + // TODO: Wait for the PR: https://github.com/eclipse-zenoh/zenoh/pull/1149 + let admin_keyexpr_prefix = + *KE_PREFIX_ADMIN_SPACE / keyexpr::new(&self.zsession.zid().to_string()).unwrap(); let admin_keyexpr_expr = (&admin_keyexpr_prefix) / *KE_ANY_N_SEGMENT; debug!("Declare admin space on {}", admin_keyexpr_expr); let admin_queryable = self .zsession .declare_queryable(admin_keyexpr_expr) - .res_async() .await .expect("Failed to create AdminSpace queryable"); @@ -907,7 +914,7 @@ impl<'a> DdsPluginRuntime<'a> { }, group_event = group_subscriber.recv_async() => { - match group_event.as_ref().map(|s|s.kind) { + match group_event.as_ref().map(|s|s.kind()) { Ok(SampleKind::Put) => { let mid = member_id!(group_event.as_ref().unwrap()); debug!("New zenoh_dds_plugin detected: {}", mid); @@ -951,7 +958,13 @@ impl<'a> DdsPluginRuntime<'a> { // - ros_discovery_info on //[]/ros_disco/ // The PublicationCache is declared on //[]/** // The QuerySubscriber is declared on /*/[]/** - let uuid: OwnedKeyExpr = self.zsession.zid().into(); + // TODO: Wait for the PR: https://github.com/eclipse-zenoh/zenoh/pull/1149 + let uuid: OwnedKeyExpr = self + .zsession + .zid() + .to_string() + .try_into() + .expect("The zsession id can't be transformed into key expr"); let fwd_key_prefix = if let Some(scope) = &self.config.scope { *KE_PREFIX_FWD_DISCO / &uuid / scope } else { @@ -971,19 +984,16 @@ impl<'a> DdsPluginRuntime<'a> { let fwd_writers_key_prefix_key = self .zsession .declare_keyexpr(fwd_writers_key_prefix) - .res_async() .await .expect("Failed to declare key expression for Fwd Discovery of writers"); let fwd_readers_key_prefix_key = self .zsession .declare_keyexpr(fwd_readers_key_prefix) - .res_async() .await .expect("Failed to declare key expression for Fwd Discovery of readers"); let fwd_ros_discovery_key_declared = self .zsession .declare_keyexpr(&fwd_ros_discovery_key) - .res_async() .await .expect("Failed to declare key expression for Fwd Discovery of ros_discovery"); @@ -992,7 +1002,6 @@ impl<'a> DdsPluginRuntime<'a> { .zsession .declare_publication_cache(fwd_declare_publication_cache_key) .queryable_allowed_origin(Locality::Remote) // Note: don't reply to queries from local QueryingSubscribers - .res_async() .await .expect("Failed to declare PublicationCache for Fwd Discovery"); @@ -1003,7 +1012,6 @@ impl<'a> DdsPluginRuntime<'a> { .querying() .allowed_origin(Locality::Remote) // Note: ignore my own publications .query_timeout(self.config.queries_timeout) - .res_async() .await .expect("Failed to declare QueryingSubscriber for Fwd Discovery"); @@ -1040,7 +1048,7 @@ impl<'a> DdsPluginRuntime<'a> { Ok(s) => s, Err(e) => { error!("INTERNAL ERROR: failed to serialize discovery message for {:?}: {}", entity, e); continue; } }; - if let Err(e) = self.zsession.put(&fwd_ke, ser_msg).congestion_control(CongestionControl::Block).res_async().await { + if let Err(e) = self.zsession.put(&fwd_ke, ser_msg).congestion_control(CongestionControl::Block).await { error!("INTERNAL ERROR: failed to publish discovery message on {}: {}", fwd_ke, e); } @@ -1055,7 +1063,7 @@ impl<'a> DdsPluginRuntime<'a> { if let Some((admin_keyexpr, _)) = self.remove_dds_writer(&key) { let fwd_ke = &fwd_writers_key_prefix_key / &admin_keyexpr; // publish its deletion from admin space - if let Err(e) = self.zsession.delete(&fwd_ke).congestion_control(CongestionControl::Block).res_async().await { + if let Err(e) = self.zsession.delete(&fwd_ke).congestion_control(CongestionControl::Block).await { error!("INTERNAL ERROR: failed to publish undiscovery message on {:?}: {}", fwd_ke, e); } } @@ -1100,7 +1108,7 @@ impl<'a> DdsPluginRuntime<'a> { Ok(s) => s, Err(e) => { error!("INTERNAL ERROR: failed to serialize discovery message for {:?}: {}", entity, e); continue; } }; - if let Err(e) = self.zsession.put(&fwd_ke, ser_msg).congestion_control(CongestionControl::Block).res_async().await { + if let Err(e) = self.zsession.put(&fwd_ke, ser_msg).congestion_control(CongestionControl::Block).await { error!("INTERNAL ERROR: failed to publish discovery message on {}: {}", fwd_ke, e); } @@ -1115,7 +1123,7 @@ impl<'a> DdsPluginRuntime<'a> { if let Some((admin_keyexpr, _)) = self.remove_dds_reader(&key) { let fwd_ke = &fwd_readers_key_prefix_key / &admin_keyexpr; // publish its deletion from admin space - if let Err(e) = self.zsession.delete(&fwd_ke).congestion_control(CongestionControl::Block).res_async().await { + if let Err(e) = self.zsession.delete(&fwd_ke).congestion_control(CongestionControl::Block).await { error!("INTERNAL ERROR: failed to publish undiscovery message on {:?}: {}", fwd_ke, e); } } @@ -1161,7 +1169,7 @@ impl<'a> DdsPluginRuntime<'a> { sample = fwd_disco_sub.recv_async() => { let sample = sample.expect("Fwd Discovery subscriber was closed!"); - let fwd_ke = &sample.key_expr; + let fwd_ke = &sample.key_expr(); debug!("Received forwarded discovery message on {}", fwd_ke); // parse fwd_ke and extract the remote uuid, the discovery kind (reader|writer|ros_disco) and the remaining of the keyexpr @@ -1171,9 +1179,9 @@ impl<'a> DdsPluginRuntime<'a> { "writer" => { // reconstruct full admin keyexpr for this entity (i.e. with it's remote plugin's uuid) let full_admin_keyexpr = *KE_PREFIX_ADMIN_SPACE / remote_uuid / remaining_ke; - if sample.kind != SampleKind::Delete { + if sample.kind() != SampleKind::Delete { // deserialize payload - let (entity, scope) = match bincode::deserialize::<(DdsEntity, Option)>(&sample.payload.contiguous()) { + let (entity, scope) = match bincode::deserialize::<(DdsEntity, Option)>(&sample.payload().into::>()) { Ok(x) => x, Err(e) => { warn!("Failed to deserialize discovery msg for {}: {}", full_admin_keyexpr, e); @@ -1251,9 +1259,9 @@ impl<'a> DdsPluginRuntime<'a> { "reader" => { // reconstruct full admin keyexpr for this entity (i.e. with it's remote plugin's uuid) let full_admin_keyexpr = *KE_PREFIX_ADMIN_SPACE / remote_uuid / remaining_ke; - if sample.kind != SampleKind::Delete { + if sample.kind() != SampleKind::Delete { // deserialize payload - let (entity, scope) = match bincode::deserialize::<(DdsEntity, Option)>(&sample.payload.contiguous()) { + let (entity, scope) = match bincode::deserialize::<(DdsEntity, Option)>(&sample.payload().into::>()) { Ok(x) => x, Err(e) => { warn!("Failed to deserialize discovery msg for {}: {}", full_admin_keyexpr, e); @@ -1328,7 +1336,7 @@ impl<'a> DdsPluginRuntime<'a> { // it's a ros_discovery_info message "ros_disco" => { match cdr::deserialize_from::<_, ParticipantEntitiesInfo, _>( - &*sample.payload.contiguous(), + sample.payload().reader(), cdr::size::Infinite, ) { Ok(mut info) => { @@ -1356,7 +1364,7 @@ impl<'a> DdsPluginRuntime<'a> { }, group_event = group_subscriber.recv_async() => { - match group_event.as_ref().map(|s|s.kind) { + match group_event.as_ref().map(|s|s.kind()) { Ok(SampleKind::Put) => { let mid = member_id!(group_event.as_ref().unwrap()); debug!("New zenoh_dds_plugin detected: {}", mid); @@ -1368,14 +1376,13 @@ impl<'a> DdsPluginRuntime<'a> { }; debug!("Query past discovery messages from {} on {}", mid, key); if let Err(e) = fwd_disco_sub.fetch( |cb| { - use zenoh_core::SyncResolve; self.zsession.get(Selector::from(&key)) .callback(cb) .target(QueryTarget::All) .consolidation(ConsolidationMode::None) .timeout(self.config.queries_timeout) - .res_sync() - }).res_async().await + .wait() + }).await { warn!("Query on {} for discovery messages failed: {}", key, e); } @@ -1458,7 +1465,7 @@ impl<'a> DdsPluginRuntime<'a> { trace!("Received ros_discovery_info from DDS for {}, forward via zenoh: {}", gid, buf.hex_encode()); // forward the payload on zenoh let ke = &fwd_ros_discovery_key_declared / ke_for_sure!(&gid); - if let Err(e) = self.zsession.put(ke, buf).res_sync() { + if let Err(e) = self.zsession.put(ke, buf).wait() { error!("Forward ROS discovery info failed: {}", e); } } diff --git a/zenoh-plugin-dds/src/route_dds_zenoh.rs b/zenoh-plugin-dds/src/route_dds_zenoh.rs index b547af0d..ab110a24 100644 --- a/zenoh-plugin-dds/src/route_dds_zenoh.rs +++ b/zenoh-plugin-dds/src/route_dds_zenoh.rs @@ -16,8 +16,12 @@ use cyclors::qos::{HistoryKind, Qos}; use cyclors::{dds_entity_t, DDS_LENGTH_UNLIMITED}; use serde::Serialize; use std::{collections::HashSet, fmt}; -use zenoh::prelude::r#async::AsyncResolve; -use zenoh::prelude::*; +use zenoh::{ + key_expr::{keyexpr, KeyExpr, OwnedKeyExpr}, + prelude::*, + publisher::CongestionControl, + sample::Locality, +}; use zenoh_ext::{PublicationCache, SessionExt}; use crate::{dds_mgt::*, qos_helpers::*, DdsPluginRuntime, KE_PREFIX_PUB_CACHE}; @@ -100,7 +104,6 @@ impl RouteDDSZenoh<'_> { let declared_ke = plugin .zsession .declare_keyexpr(ke.clone()) - .res() .await .map_err(|e| { format!("Route Zenoh->DDS ({topic_name} -> {ke}): failed to declare KeyExpr: {e}") @@ -144,19 +147,13 @@ impl RouteDDSZenoh<'_> { .history(history) .queryable_prefix(*KE_PREFIX_PUB_CACHE / &plugin.member_id) .queryable_allowed_origin(Locality::Remote) // Note: don't reply to queries from local QueryingSubscribers - .res() .await .map_err(|e| { format!("Failed create PublicationCache for key {ke} (rid={declared_ke}): {e}") })?; ZPublisher::PublicationCache(pub_cache) } else { - if let Err(e) = plugin - .zsession - .declare_publisher(declared_ke.clone()) - .res() - .await - { + if let Err(e) = plugin.zsession.declare_publisher(declared_ke.clone()).await { tracing::warn!( "Failed to declare publisher for key {} (rid={}): {}", ke, diff --git a/zenoh-plugin-dds/src/route_zenoh_dds.rs b/zenoh-plugin-dds/src/route_zenoh_dds.rs index 83272f34..4667ae2d 100644 --- a/zenoh-plugin-dds/src/route_zenoh_dds.rs +++ b/zenoh-plugin-dds/src/route_zenoh_dds.rs @@ -21,9 +21,14 @@ use std::collections::HashSet; use std::sync::atomic::Ordering; use std::sync::Arc; use std::{ffi::CStr, fmt, sync::atomic::AtomicI32, time::Duration}; -use zenoh::prelude::*; -use zenoh::query::ReplyKeyExpr; -use zenoh::{prelude::r#async::AsyncResolve, subscriber::Subscriber}; +use zenoh::{ + key_expr::{keyexpr, KeyExpr, OwnedKeyExpr}, + query::{ConsolidationMode, QueryTarget, ReplyKeyExpr}, + sample::{Locality, Sample}, + selector::Selector, + subscriber::Subscriber, + {prelude::*, Session}, +}; use zenoh_ext::{FetchingSubscriber, SubscriberBuilderExt}; use crate::DdsPluginRuntime; @@ -135,12 +140,12 @@ impl RouteZenohDDS<'_> { // before the discovery message provoking the creation of the Data Writer tracing::debug!( "Route Zenoh->DDS ({} -> {}): data arrived but no DDS Writer yet to route it... wait 3s for discovery forwarding msg", - s.key_expr, + s.key_expr(), &ton ); let arc_dw2 = arc_dw.clone(); let ton2 = ton.clone(); - let ke = s.key_expr.clone(); + let ke = s.key_expr().clone(); async_std::task::spawn(async move { for _ in 1..30 { async_std::task::sleep(Duration::from_millis(100)).await; @@ -181,7 +186,6 @@ impl RouteZenohDDS<'_> { .query_timeout(plugin.config.queries_timeout) .query_selector(query_selector) .query_accept_replies(ReplyKeyExpr::Any) - .res() .await .map_err(|e| { format!( @@ -196,7 +200,6 @@ impl RouteZenohDDS<'_> { .callback(subscriber_callback) .allowed_origin(Locality::Remote) // Allow only remote publications to avoid loops .reliable() - .res() .await .map_err(|e| { format!( @@ -290,7 +293,6 @@ impl RouteZenohDDS<'_> { let session = &self.zenoh_session; let s = s.clone(); move |cb| { - use zenoh_core::SyncResolve; session .get(&s) .target(QueryTarget::All) @@ -298,10 +300,9 @@ impl RouteZenohDDS<'_> { .accept_replies(ReplyKeyExpr::Any) .timeout(query_timeout) .callback(cb) - .res_sync() + .wait() } }) - .res() .await { tracing::warn!( @@ -358,20 +359,20 @@ fn do_route_data(s: Sample, topic_name: &str, data_writer: dds_entity_t) { if *LOG_PAYLOAD { tracing::trace!( "Route Zenoh->DDS ({} -> {}): routing data - payload: {:?}", - s.key_expr, + s.key_expr(), &topic_name, - s.value.payload + s.payload() ); } else { tracing::trace!( "Route Zenoh->DDS ({} -> {}): routing data", - s.key_expr, + s.key_expr(), &topic_name ); } unsafe { - let bs = s.value.payload.contiguous().into_owned(); + let bs = s.payload().into(); // 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. @@ -401,7 +402,7 @@ fn do_route_data(s: Sample, topic_name: &str, data_writer: dds_entity_t) { if ret < 0 { tracing::warn!( "Route Zenoh->DDS ({} -> {}): can't route data; sertype lookup failed ({})", - s.key_expr, + s.key_expr(), topic_name, CStr::from_ptr(dds_strretcode(ret)) .to_str()