diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aeb3c0c..269f49e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: rustup component add rustfmt clippy - name: Code format check - run: cargo fmt --check + run: cargo fmt -p zenoh-plugin-ros1 -p zenoh-bridge-ros1 --check -- --config "unstable_features=true,imports_granularity=Crate,group_imports=StdExternalCrate" env: CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse @@ -83,13 +83,11 @@ jobs: run: cargo test --verbose env: CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse - ASYNC_STD_THREAD_COUNT: 4 - name: Run doctests run: cargo test --doc env: CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse - ASYNC_STD_THREAD_COUNT: 4 # NOTE: In GitHub repository settings, the "Require status checks to pass # before merging" branch protection rule ensures that commits are only merged diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..2ac4511 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +repos: + - repo: local + hooks: + - id: fmt + name: fmt + entry: cargo fmt -p zenoh-plugin-ros1 -p zenoh-bridge-ros1 -- --config "unstable_features=true,imports_granularity=Crate,group_imports=StdExternalCrate" + language: system + types: [rust] diff --git a/Cargo.lock b/Cargo.lock index d7d1e53..3f72714 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -45,9 +45,9 @@ dependencies = [ [[package]] name = "aes" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if 1.0.0", "cipher 0.4.4", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if 1.0.0", "getrandom 0.2.10", @@ -158,9 +158,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "array-init" @@ -187,13 +187,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" [[package]] -name = "async-attributes" -version = "1.1.2" +name = "asn1-rs" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" +checksum = "22ad1373757efa0f70ec53939aabc7152e1591cb485208052993070ac8d2429d" dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror", + "time 0.3.36", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7378575ff571966e99a744addeff0bff98b8ada0dedf1956d59e634db95eaac1" +dependencies = [ + "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.52", + "synstructure", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", ] [[package]] @@ -207,6 +236,18 @@ dependencies = [ "futures-core", ] +[[package]] +name = "async-channel" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite 0.2.13", +] + [[package]] name = "async-dup" version = "1.2.2" @@ -219,30 +260,29 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.5.1" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fa3dc5f2a8564f07759c008b9109dc0d39de92a88d5588b8a5036d286383afb" +checksum = "d7ebdfa2ebdab6b1760375fa7d6f382b9f486eac35fc994625a00e89280bdbb7" dependencies = [ - "async-lock", "async-task", "concurrent-queue", - "fastrand 1.9.0", - "futures-lite", + "fastrand 2.0.2", + "futures-lite 2.0.0", "slab", ] [[package]] name = "async-global-executor" -version = "2.3.1" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" +checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ - "async-channel", + "async-channel 2.3.1", "async-executor", - "async-io", - "async-lock", + "async-io 2.3.3", + "async-lock 3.4.0", "blocking", - "futures-lite", + "futures-lite 2.0.0", "once_cell", "tokio", ] @@ -253,7 +293,7 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8101020758a4fc3a7c326cb42aa99e9fa77cbfb76987c128ad956406fe1f70a7" dependencies = [ - "async-channel", + "async-channel 1.9.0", "async-dup", "async-std", "futures-core", @@ -269,20 +309,39 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ - "async-lock", + "async-lock 2.8.0", "autocfg", "cfg-if 1.0.0", "concurrent-queue", - "futures-lite", + "futures-lite 1.13.0", "log 0.4.20", "parking", - "polling", + "polling 2.8.0", "rustix 0.37.25", "slab", "socket2 0.4.9", "waker-fn", ] +[[package]] +name = "async-io" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d6baa8f0178795da0e71bc42c9e5d13261aac7ee549853162e66a241ba17964" +dependencies = [ + "async-lock 3.4.0", + "cfg-if 1.0.0", + "concurrent-queue", + "futures-io", + "futures-lite 2.0.0", + "parking", + "polling 3.7.2", + "rustix 0.38.32", + "slab", + "tracing", + "windows-sys 0.52.0", +] + [[package]] name = "async-lock" version = "2.8.0" @@ -292,19 +351,30 @@ dependencies = [ "event-listener 2.5.3", ] +[[package]] +name = "async-lock" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" +dependencies = [ + "event-listener 5.3.1", + "event-listener-strategy", + "pin-project-lite 0.2.13", +] + [[package]] name = "async-process" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a9d28b1d97e08915212e2e45310d47854eafa69600756fc735fb788f75199c9" dependencies = [ - "async-io", - "async-lock", + "async-io 1.13.0", + "async-lock 2.8.0", "autocfg", "blocking", "cfg-if 1.0.0", "event-listener 2.5.3", - "futures-lite", + "futures-lite 1.13.0", "rustix 0.37.25", "signal-hook", "windows-sys 0.48.0", @@ -337,7 +407,7 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53bba003996b8fd22245cd0c59b869ba764188ed435392cf2796d03b805ade10" dependencies = [ - "async-channel", + "async-channel 1.9.0", "async-std", "http-types", "log 0.4.20", @@ -351,17 +421,16 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" dependencies = [ - "async-attributes", - "async-channel", + "async-channel 1.9.0", "async-global-executor", - "async-io", - "async-lock", + "async-io 1.13.0", + "async-lock 2.8.0", "async-process", "crossbeam-utils", "futures-channel", "futures-core", "futures-io", - "futures-lite", + "futures-lite 1.13.0", "gloo-timers", "kv-log-macro", "log 0.4.20", @@ -381,13 +450,13 @@ checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.52", ] [[package]] @@ -481,6 +550,12 @@ version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "base64ct" version = "1.6.0" @@ -573,17 +648,15 @@ dependencies = [ [[package]] name = "blocking" -version = "1.3.1" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77231a1c8f801696fc0123ec6150ce92cffb8e164a02afb9c8ddee0e9b65ad65" +checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" dependencies = [ - "async-channel", - "async-lock", + "async-channel 2.3.1", "async-task", - "atomic-waker", - "fastrand 1.9.0", - "futures-lite", - "log 0.4.20", + "futures-io", + "futures-lite 2.0.0", + "piper", ] [[package]] @@ -637,9 +710,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.5.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" [[package]] name = "cache-padded" @@ -680,6 +753,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "chrono" version = "0.4.30" @@ -766,9 +845,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "2.2.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" dependencies = [ "crossbeam-utils", ] @@ -787,18 +866,18 @@ checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" [[package]] name = "const_format" -version = "0.2.31" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c990efc7a285731f9a4378d81aff2f0e85a2c8781a05ef0f8baa8dac54d0ff48" +checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" dependencies = [ "const_format_proc_macros", ] [[package]] name = "const_format_proc_macros" -version = "0.2.31" +version = "0.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e026b6ce194a874cb9cf32cd5772d1ef9767cc8fcb5765948d74f37a9d8b2bf6" +checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" dependencies = [ "proc-macro2", "quote", @@ -821,7 +900,7 @@ dependencies = [ "base64 0.13.1", "hkdf", "hmac 0.10.1", - "percent-encoding 2.3.0", + "percent-encoding 2.3.1", "rand 0.8.5", "sha2 0.9.9", "time 0.2.27", @@ -980,7 +1059,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if 1.0.0", - "hashbrown 0.14.0", + "hashbrown 0.14.5", "lock_api", "once_cell", "parking_lot_core", @@ -1013,6 +1092,20 @@ dependencies = [ "zeroize", ] +[[package]] +name = "der-parser" +version = "9.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cd0a5c643689626bec213c4d8bd4d96acc8ffdb4ad4bb6bc16abf27d5f4b553" +dependencies = [ + "asn1-rs", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", +] + [[package]] name = "deranged" version = "0.3.11" @@ -1070,6 +1163,17 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" +[[package]] +name = "displaydoc" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "duration-string" version = "0.3.0" @@ -1084,9 +1188,9 @@ checksum = "bbfc4744c1b8f2a09adc0e55242f60b1af195d88596bd8700be74418c056c555" [[package]] name = "either" -version = "1.9.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "equivalent" @@ -1140,23 +1244,34 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "event-listener" -version = "4.0.0" +version = "5.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "770d968249b5d99410d61f5bf89057f3199a077a04d087092f58e7d10692baae" +checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" dependencies = [ "concurrent-queue", "parking", "pin-project-lite 0.2.13", ] +[[package]] +name = "event-listener-strategy" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +dependencies = [ + "event-listener 5.3.1", + "pin-project-lite 0.2.13", +] + [[package]] name = "fancy-regex" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2" +checksum = "531e46835a22af56d1e3b66f04844bed63158bc094a628bec1d321d9b4c44bf2" dependencies = [ "bit-set", - "regex 1.9.5", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] @@ -1217,7 +1332,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin 0.9.8", + "spin", ] [[package]] @@ -1228,18 +1343,18 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ - "percent-encoding 2.3.0", + "percent-encoding 2.3.1", ] [[package]] name = "fraction" -version = "0.13.1" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3027ae1df8d41b4bed2241c8fdad4acc1e7af60c8e17743534b545e77182d678" +checksum = "0f158e3ff0a1b334408dc9fb811cd99b446986f4d8b741bb08f9df1604085ae7" dependencies = [ "lazy_static", "num", @@ -1253,9 +1368,9 @@ checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" [[package]] name = "futures" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -1268,9 +1383,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -1278,15 +1393,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -1295,9 +1410,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" @@ -1314,34 +1429,49 @@ dependencies = [ "waker-fn", ] +[[package]] +name = "futures-lite" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c1155db57329dca6d018b61e76b1488ce9a2e5e44028cac420a5898f4fcef63" +dependencies = [ + "fastrand 2.0.2", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite 0.2.13", + "waker-fn", +] + [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.52", ] [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -1407,24 +1537,22 @@ checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "git-version" -version = "0.3.5" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6b0decc02f4636b9ccad390dcbe77b722a77efedfa393caf8379a51d5c61899" +checksum = "1ad568aa3db0fcbc81f2f116137f263d7304f512a1209b35b85150d3ef88ad19" dependencies = [ "git-version-macro", - "proc-macro-hack", ] [[package]] name = "git-version-macro" -version = "0.3.5" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe69f1cbdb6e28af2bac214e943b99ce8a0a06b447d15d3e61161b0423139f3f" +checksum = "53010ccb100b96a67bc32c0175f0ed1426b31b655d562898e57325f81c023ac0" dependencies = [ - "proc-macro-hack", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.52", ] [[package]] @@ -1449,25 +1577,22 @@ dependencies = [ ] [[package]] -name = "hashbrown" -version = "0.12.3" +name = "half" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "hashbrown" -version = "0.13.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash", -] +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", @@ -1490,9 +1615,15 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hermit-abi" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" [[package]] name = "hex" @@ -1541,11 +1672,11 @@ dependencies = [ [[package]] name = "home" -version = "0.5.5" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1589,11 +1720,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e9b187a72d63adbfba487f48095306ac823049cb504ee195541e91c7775f5ad" dependencies = [ "anyhow", - "async-channel", + "async-channel 1.9.0", "async-std", "base64 0.13.1", "cookie", - "futures-lite", + "futures-lite 1.13.0", "infer", "pin-project-lite 0.2.13", "rand 0.7.3", @@ -1601,7 +1732,7 @@ dependencies = [ "serde_json", "serde_qs", "serde_urlencoded", - "url 2.4.1", + "url 2.5.2", ] [[package]] @@ -1677,9 +1808,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1697,12 +1828,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown 0.14.5", ] [[package]] @@ -1735,7 +1866,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi 0.3.9", "libc", "windows-sys 0.48.0", ] @@ -1758,6 +1889,12 @@ dependencies = [ "nom", ] +[[package]] +name = "iter-read" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c397ca3ea05ad509c4ec451fea28b4771236a376ca1c69fd5143aae0cf8f93c4" + [[package]] name = "itertools" version = "0.10.5" @@ -1767,6 +1904,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.9" @@ -1815,13 +1961,13 @@ dependencies = [ [[package]] name = "jsonschema" -version = "0.17.1" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a071f4f7efc9a9118dfb627a0a94ef247986e1ab8606a4c806ae2b3aa3b6978" +checksum = "f5f037c58cadb17e8591b620b523cc6a7ab2b91b6ce3121f8eb4171f8d80115c" dependencies = [ "ahash", "anyhow", - "base64 0.21.4", + "base64 0.22.1", "bytecount", "fancy-regex", "fraction", @@ -1832,12 +1978,12 @@ dependencies = [ "num-cmp", "once_cell", "parking_lot", - "percent-encoding 2.3.0", - "regex 1.9.5", + "percent-encoding 2.3.1", + "regex 1.10.6", "serde", "serde_json", "time 0.3.36", - "url 2.4.1", + "url 2.5.2", "uuid", ] @@ -1852,11 +1998,11 @@ dependencies = [ [[package]] name = "keyed-set" -version = "0.4.5" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b79e110283e09081809ca488cf3a9709270c6d4d4c4a32674c39cc438366615a" +checksum = "0a3ec39d2dc17953a1540d63906a112088f79b2e46833b4ed65bc9de3904ae34" dependencies = [ - "hashbrown 0.13.2", + "hashbrown 0.14.5", ] [[package]] @@ -1876,18 +2022,18 @@ checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" dependencies = [ - "spin 0.5.2", + "spin", ] [[package]] name = "libc" -version = "0.2.153" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libloading" @@ -1995,9 +2141,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.6.3" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mime" @@ -2041,13 +2187,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.11" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ + "hermit-abi 0.3.9", "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2085,24 +2232,25 @@ dependencies = [ [[package]] name = "nix" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" +checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" dependencies = [ "bitflags 2.5.0", "cfg-if 1.0.0", + "cfg_aliases 0.1.1", "libc", ] [[package]] name = "nix" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ "bitflags 2.5.0", "cfg-if 1.0.0", - "cfg_aliases", + "cfg_aliases 0.2.1", "libc", ] @@ -2134,9 +2282,9 @@ dependencies = [ [[package]] name = "num" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" dependencies = [ "num-bigint", "num-complex", @@ -2182,9 +2330,9 @@ checksum = "63335b2e2c34fae2fb0aa2cecfd9f0832a1e24b3b32ecec612c3426d46dc8aaa" [[package]] name = "num-complex" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -2197,19 +2345,18 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-iter" -version = "0.1.43" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -2230,9 +2377,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", "libm", @@ -2244,7 +2391,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi 0.3.9", "libc", ] @@ -2266,6 +2413,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "oid-registry" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c958dd45046245b9c3c2547369bb634eb461670b2e7e0de552905801a648d1d" +dependencies = [ + "asn1-rs", +] + [[package]] name = "once_cell" version = "1.19.0" @@ -2292,9 +2448,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "ordered-float" -version = "4.1.1" +version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "536900a8093134cf9ccf00a27deb3532421099e958d9dd431135d0c7543ca1e8" +checksum = "4a91171844676f8c7990ce64959210cd2eaef32c2612c50f9fae9f8aaa6065a6" dependencies = [ "num-traits", ] @@ -2342,9 +2498,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pem-rfc7468" @@ -2363,9 +2519,9 @@ checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" @@ -2398,7 +2554,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.52", ] [[package]] @@ -2414,12 +2570,54 @@ dependencies = [ [[package]] name = "petgraph" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.0.0", + "indexmap 2.4.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.52", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", ] [[package]] @@ -2439,7 +2637,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.52", ] [[package]] @@ -2460,6 +2658,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "piper" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" +dependencies = [ + "atomic-waker", + "fastrand 2.0.2", + "futures-io", +] + [[package]] name = "pkcs1" version = "0.7.5" @@ -2483,18 +2692,18 @@ dependencies = [ [[package]] name = "pnet_base" -version = "0.34.0" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe4cf6fb3ab38b68d01ab2aea03ed3d1132b4868fa4e06285f29f16da01c5f4c" +checksum = "ffc190d4067df16af3aba49b3b74c469e611cad6314676eaf1157f31aa0fb2f7" dependencies = [ "no-std-net", ] [[package]] name = "pnet_datalink" -version = "0.34.0" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad5854abf0067ebbd3967f7d45ebc8976ff577ff0c7bd101c4973ae3c70f98fe" +checksum = "e79e70ec0be163102a332e1d2d5586d362ad76b01cec86f830241f2b6452a7b7" dependencies = [ "ipnetwork", "libc", @@ -2505,9 +2714,9 @@ dependencies = [ [[package]] name = "pnet_sys" -version = "0.34.0" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "417c0becd1b573f6d544f73671070b039051e5ad819cc64aa96377b536128d00" +checksum = "7d4643d3d4db6b08741050c2f3afa9a892c4244c085a72fcda93c9c2c9a00f4b" dependencies = [ "libc", "winapi", @@ -2529,6 +2738,21 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "polling" +version = "3.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3ed00ed3fbf728b5816498ecd316d1716eecaced9c0c8d2c5a6740ca214985b" +dependencies = [ + "cfg-if 1.0.0", + "concurrent-queue", + "hermit-abi 0.4.0", + "pin-project-lite 0.2.13", + "rustix 0.38.32", + "tracing", + "windows-sys 0.52.0", +] + [[package]] name = "polyval" version = "0.4.5" @@ -2560,9 +2784,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -2575,16 +2799,17 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quinn" -version = "0.11.1" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904e3d3ba178131798c6d9375db2b13b34337d489b089fc5ba0825a2ff1bee73" +checksum = "b22d8e7369034b9a7132bc2008cac12f2013c8132b45e0554e6e20e2617f2156" dependencies = [ "bytes", "pin-project-lite 0.2.13", "quinn-proto", "quinn-udp", - "rustc-hash", + "rustc-hash 2.0.0", "rustls", + "socket2 0.5.7", "thiserror", "tokio", "tracing", @@ -2592,14 +2817,14 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e974563a4b1c2206bbc61191ca4da9c22e4308b4c455e8906751cc7828393f08" +checksum = "ddf517c03a109db8100448a4be38d498df8a210a99fe0e1b9eaf39e78c640efe" dependencies = [ "bytes", "rand 0.8.5", "ring", - "rustc-hash", + "rustc-hash 1.1.0", "rustls", "rustls-platform-verifier", "slab", @@ -2610,22 +2835,22 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.1" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4f0def2590301f4f667db5a77f9694fb004f82796dc1a8b1508fafa3d0e8b72" +checksum = "8bffec3605b73c6f1754535084a85229fa8a30f86014e6c81aeec4abb68b0285" dependencies = [ "libc", "once_cell", - "socket2 0.5.6", + "socket2 0.5.7", "tracing", "windows-sys 0.52.0", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -2754,14 +2979,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.5" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick 1.0.5", "memchr", - "regex-automata 0.3.8", - "regex-syntax 0.7.5", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] @@ -2775,13 +3000,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.8" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick 1.0.5", "memchr", - "regex-syntax 0.7.5", + "regex-syntax 0.8.4", ] [[package]] @@ -2801,9 +3026,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "ring" @@ -2814,7 +3039,7 @@ dependencies = [ "cc", "getrandom 0.2.10", "libc", - "spin 0.9.8", + "spin", "untrusted", "windows-sys 0.48.0", ] @@ -2847,10 +3072,10 @@ version = "0.1.1" dependencies = [ "array-init", "hex", - "itertools", + "itertools 0.10.5", "lazy_static", "md-5", - "regex 1.9.5", + "regex 1.10.6", "serde", "serde_derive", "thiserror", @@ -2867,7 +3092,7 @@ dependencies = [ "error-chain 0.12.4", "hostname", "lazy_static", - "regex 1.9.5", + "regex 1.10.6", "ros_message", "rosrust_codegen", "serde", @@ -2904,7 +3129,7 @@ dependencies = [ "deflate", "filetime", "multipart", - "percent-encoding 2.3.0", + "percent-encoding 2.3.1", "rand 0.8.5", "serde", "serde_derive", @@ -2913,7 +3138,7 @@ dependencies = [ "threadpool", "time 0.3.36", "tiny_http", - "url 2.4.1", + "url 2.5.2", ] [[package]] @@ -2956,6 +3181,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustc_version" version = "0.2.3" @@ -2967,13 +3198,22 @@ dependencies = [ [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver 1.0.18", ] +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom", +] + [[package]] name = "rustix" version = "0.37.25" @@ -3003,9 +3243,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.9" +version = "0.23.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a218f0f6d05669de4eabfb24f31ce802035c952429d037507b4a4a39f0e60c5b" +checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" dependencies = [ "log 0.4.20", "once_cell", @@ -3031,19 +3271,19 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.0.0" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35e4980fa29e4c4b212ffb3db068a564cbf560e51d3944b7c88bd8bf5bec64f4" +checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ - "base64 0.21.4", + "base64 0.22.1", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-platform-verifier" @@ -3074,9 +3314,9 @@ checksum = "84e217e7fdc8466b5b35d30f8c0a30febd29173df4a3a0c2115d306b9c4117ad" [[package]] name = "rustls-webpki" -version = "0.102.4" +version = "0.102.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +checksum = "84678086bd54edf2b415183ed7a94d0efb049f1b646a33e22a36f3794be6ae56" dependencies = [ "ring", "rustls-pki-types", @@ -3085,9 +3325,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" @@ -3127,11 +3367,12 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.13" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763f8cd0d4c71ed8389c90cb8100cba87e763bd01a8e614d4f0af97bcd50a161" +checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" dependencies = [ "dyn-clone", + "either", "schemars_derive", "serde", "serde_json", @@ -3139,14 +3380,14 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.13" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0f696e21e10fa546b7ffb1c9672c6de8fbc7a81acf59524386d8639bf12737" +checksum = "b1eee588578aff73f856ab961cd2f79e36bc45d7ded33a7562adba4667aecc0e" dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 1.0.109", + "syn 2.0.52", ] [[package]] @@ -3212,13 +3453,26 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.209" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" 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-xml-rs" version = "0.2.1" @@ -3239,26 +3493,36 @@ dependencies = [ "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.209" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.52", ] [[package]] name = "serde_derive_internals" -version = "0.26.0" +version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.52", ] [[package]] @@ -3272,11 +3536,12 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.127" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -3287,7 +3552,7 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7715380eec75f029a4ef7de39a9200e0a63823176b759d055b613f5a87df6a6" dependencies = [ - "percent-encoding 2.3.0", + "percent-encoding 2.3.1", "serde", "thiserror", ] @@ -3306,11 +3571,11 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.25" +version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.4.0", "itoa", "ryu", "serde", @@ -3324,7 +3589,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c789ec87f4687d022a2405cf46e0cd6284889f1839de292cadeb6c6019506f2" dependencies = [ "dashmap", - "futures 0.3.28", + "futures 0.3.30", "lazy_static", "log 0.4.20", "parking_lot", @@ -3458,6 +3723,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" @@ -3469,9 +3740,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" @@ -3485,20 +3756,14 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", "windows-sys 0.52.0", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "spin" version = "0.9.8" @@ -3588,7 +3853,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af91f480ee899ab2d9f8435bfdfc14d08a5754bd9d3fef1f1a1c23336aad6c8b" dependencies = [ - "async-channel", + "async-channel 1.9.0", "cfg-if 1.0.0", "futures-core", "pin-project-lite 0.2.13", @@ -3706,15 +3971,26 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.33" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9caece70c63bfba29ec2fed841a09851b14a235c60010fa4de58089b6c025668" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + [[package]] name = "tempfile" version = "3.10.1" @@ -3736,6 +4012,39 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "test-case" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb2550dd13afcd286853192af8601920d959b14c401fcece38071d53bf0768a8" +dependencies = [ + "test-case-macros", +] + +[[package]] +name = "test-case-core" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adcb7fd841cd518e279be3d5a3eb0636409487998a4aff22f3de87b81e88384f" +dependencies = [ + "cfg-if 1.0.0", + "proc-macro2", + "quote", + "syn 2.0.52", +] + +[[package]] +name = "test-case-macros" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", + "test-case-core", +] + [[package]] name = "textwrap" version = "0.16.1" @@ -3759,7 +4068,7 @@ checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.52", ] [[package]] @@ -3846,6 +4155,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", + "itoa", "libc", "num-conv", "num_threads", @@ -3932,30 +4242,30 @@ dependencies = [ [[package]] name = "tokio" -version = "1.36.0" +version = "1.39.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "pin-project-lite 0.2.13", - "socket2 0.5.6", + "signal-hook-registry", + "socket2 0.5.7", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.52", ] [[package]] @@ -3971,9 +4281,9 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.21.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" +checksum = "c6989540ced10490aaf14e6bad2e3d33728a2813310a0c71d1574304c49631cd" dependencies = [ "futures-util", "log 0.4.20", @@ -3983,15 +4293,15 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", "futures-sink", "futures-util", - "hashbrown 0.14.0", + "hashbrown 0.14.5", "pin-project-lite 0.2.13", "tokio", ] @@ -4017,7 +4327,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.52", ] [[package]] @@ -4060,7 +4370,7 @@ dependencies = [ "matchers", "nu-ansi-term", "once_cell", - "regex 1.9.5", + "regex 1.10.6", "serde", "serde_json", "sharded-slab", @@ -4080,9 +4390,9 @@ checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" [[package]] name = "tungstenite" -version = "0.21.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" +checksum = "6e2e2ce1e47ed2994fd43b04c8f618008d4cabdd5ee34027cf14f9d918edd9c8" dependencies = [ "byteorder", "bytes", @@ -4093,7 +4403,6 @@ dependencies = [ "rand 0.8.5", "sha1 0.10.5", "thiserror", - "url 2.4.1", "utf-8", ] @@ -4142,16 +4451,16 @@ checksum = "abd2fc5d32b590614af8b0a20d837f32eca055edd0bbead59a9cfe80858be003" [[package]] name = "uhlc" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99b6df3f3e948b40e20c38a6d1fd6d8f91b3573922fc164e068ad3331560487e" +checksum = "79ac3c37bd9506595768f0387bd39d644525728b4a1d783218acabfb56356db7" dependencies = [ "humantime", "lazy_static", "log 0.4.20", "rand 0.8.5", "serde", - "spin 0.9.8", + "spin", ] [[package]] @@ -4174,9 +4483,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -4186,9 +4495,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] @@ -4211,9 +4520,9 @@ dependencies = [ [[package]] name = "unsafe-libyaml" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" [[package]] name = "untrusted" @@ -4221,6 +4530,12 @@ 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" @@ -4245,13 +4560,13 @@ dependencies = [ [[package]] name = "url" -version = "2.4.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", - "idna 0.4.0", - "percent-encoding 2.3.0", + "idna 0.5.0", + "percent-encoding 2.3.1", "serde", ] @@ -4269,9 +4584,9 @@ checksum = "7fcfc827f90e53a02eaef5e535ee14266c1d569214c6aa70133a624d8a3164ba" [[package]] name = "uuid" -version = "1.4.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" dependencies = [ "getrandom 0.2.10", ] @@ -4417,7 +4732,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.52", "wasm-bindgen-shared", ] @@ -4451,7 +4766,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.52", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4474,9 +4789,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.0" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de2cfda980f21be5a7ed2eadb3e6fe074d56022bea2cdeb1a62eb220fc04188" +checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" dependencies = [ "rustls-pki-types", ] @@ -4653,6 +4968,23 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +[[package]] +name = "x509-parser" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcbc162f30700d6f3f82a24bf7cc62ffe7caea42c0b2cba8bf7f3ae50cf51f69" +dependencies = [ + "asn1-rs", + "data-encoding", + "der-parser", + "lazy_static", + "nom", + "oid-registry", + "rusticata-macros", + "thiserror", + "time 0.3.36", +] + [[package]] name = "xml-rpc" version = "0.0.12" @@ -4702,33 +5034,40 @@ dependencies = [ [[package]] name = "zenoh" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "ahash", "async-trait", - "base64 0.21.4", - "const_format", - "event-listener 4.0.0", + "base64 0.22.1", + "bytes", + "event-listener 5.3.1", "flume", "form_urlencoded", - "futures 0.3.28", + "futures 0.3.30", "git-version", + "itertools 0.13.0", "lazy_static", + "once_cell", "ordered-float", "paste", "petgraph", + "phf", "rand 0.8.5", - "regex 1.9.5", - "rustc_version 0.4.0", + "regex 1.10.6", + "rustc_version 0.4.1", "serde", + "serde-pickle", + "serde_cbor", "serde_json", - "socket2 0.5.6", + "serde_yaml", + "socket2 0.5.7", "stop-token", "tokio", "tokio-util", "tracing", "uhlc", + "unwrap-infallible", "uuid", "vec_map", "zenoh-buffers", @@ -4752,33 +5091,32 @@ dependencies = [ [[package]] name = "zenoh-bridge-ros1" -version = "0.11.0-dev" +version = "1.0.0-dev" dependencies = [ - "async-std", "clap", "ctrlc", "lazy_static", "serde_json", + "tokio", "tracing", "zenoh", "zenoh-plugin-rest", "zenoh-plugin-ros1", "zenoh-plugin-trait", - "zenoh-util", ] [[package]] name = "zenoh-buffers" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "zenoh-collections", ] [[package]] name = "zenoh-codec" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "serde", "tracing", @@ -4789,13 +5127,13 @@ dependencies = [ [[package]] name = "zenoh-collections" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" [[package]] name = "zenoh-config" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "flume", "json5", @@ -4805,8 +5143,10 @@ dependencies = [ "serde_json", "serde_yaml", "tracing", + "uhlc", "validated_struct", "zenoh-core", + "zenoh-macros", "zenoh-protocol", "zenoh-result", "zenoh-util", @@ -4814,8 +5154,8 @@ dependencies = [ [[package]] name = "zenoh-core" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "async-global-executor", "lazy_static", @@ -4826,10 +5166,10 @@ dependencies = [ [[package]] name = "zenoh-crypto" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ - "aes 0.8.3", + "aes 0.8.4", "hmac 0.12.1", "rand 0.8.5", "rand_chacha 0.3.1", @@ -4837,33 +5177,12 @@ dependencies = [ "zenoh-result", ] -[[package]] -name = "zenoh-ext" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" -dependencies = [ - "bincode", - "flume", - "futures 0.3.28", - "serde", - "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#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ - "hashbrown 0.14.0", + "hashbrown 0.14.5", "keyed-set", "rand 0.8.5", "schemars", @@ -4874,8 +5193,8 @@ dependencies = [ [[package]] name = "zenoh-link" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "async-trait", "zenoh-config", @@ -4892,18 +5211,19 @@ dependencies = [ [[package]] name = "zenoh-link-commons" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "async-trait", "flume", - "futures 0.3.28", + "futures 0.3.30", "rustls", "rustls-webpki", "serde", "tokio", "tokio-util", "tracing", + "webpki-roots", "zenoh-buffers", "zenoh-codec", "zenoh-config", @@ -4916,12 +5236,12 @@ dependencies = [ [[package]] name = "zenoh-link-quic" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "async-trait", - "base64 0.21.4", - "futures 0.3.28", + "base64 0.22.1", + "futures 0.3.30", "quinn", "rustls", "rustls-pemfile", @@ -4933,6 +5253,8 @@ dependencies = [ "tokio-util", "tracing", "webpki-roots", + "x509-parser", + "zenoh-collections", "zenoh-config", "zenoh-core", "zenoh-link-commons", @@ -4945,10 +5267,11 @@ dependencies = [ [[package]] name = "zenoh-link-tcp" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "async-trait", + "socket2 0.5.7", "tokio", "tokio-util", "tracing", @@ -4963,22 +5286,25 @@ dependencies = [ [[package]] name = "zenoh-link-tls" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "async-trait", - "base64 0.21.4", - "futures 0.3.28", + "base64 0.22.1", + "futures 0.3.30", "rustls", "rustls-pemfile", "rustls-pki-types", "rustls-webpki", "secrecy", + "socket2 0.5.7", "tokio", "tokio-rustls", "tokio-util", "tracing", "webpki-roots", + "x509-parser", + "zenoh-collections", "zenoh-config", "zenoh-core", "zenoh-link-commons", @@ -4991,11 +5317,11 @@ dependencies = [ [[package]] name = "zenoh-link-udp" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "async-trait", - "socket2 0.5.6", + "socket2 0.5.7", "tokio", "tokio-util", "tracing", @@ -5012,12 +5338,12 @@ dependencies = [ [[package]] name = "zenoh-link-unixsock_stream" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "async-trait", - "futures 0.3.28", - "nix 0.27.1", + "futures 0.3.30", + "nix 0.29.0", "tokio", "tokio-util", "tracing", @@ -5032,8 +5358,8 @@ dependencies = [ [[package]] name = "zenoh-link-ws" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "async-trait", "futures-util", @@ -5041,7 +5367,7 @@ dependencies = [ "tokio-tungstenite", "tokio-util", "tracing", - "url 2.4.1", + "url 2.5.2", "zenoh-core", "zenoh-link-commons", "zenoh-protocol", @@ -5053,81 +5379,76 @@ dependencies = [ [[package]] name = "zenoh-macros" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.52", "zenoh-keyexpr", ] [[package]] name = "zenoh-plugin-rest" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "anyhow", - "async-std", - "base64 0.21.4", + "base64 0.22.1", "const_format", "flume", - "futures 0.3.28", + "futures 0.3.30", "git-version", "http-types", "jsonschema", "lazy_static", - "rustc_version 0.4.0", + "rustc_version 0.4.1", "schemars", "serde", "serde_json", "tide", + "tokio", "tracing", "zenoh", "zenoh-plugin-trait", - "zenoh-result", - "zenoh-util", ] [[package]] name = "zenoh-plugin-ros1" -version = "0.11.0-dev" +version = "1.0.0-dev" dependencies = [ "async-global-executor", - "async-std", "async-trait", "atoi", "ctrlc", "duration-string", "flume", - "futures 0.3.28", + "futures 0.3.30", "git-version", "hex", "lazy_static", "multiset", "rand 0.8.5", "rosrust", - "rustc_version 0.4.0", + "rustc_version 0.4.1", "serde", "serde_json", "serial_test", "strum", "strum_macros", + "test-case", + "tokio", "tracing", "xml-rpc", "zenoh", - "zenoh-core", - "zenoh-ext", "zenoh-plugin-trait", - "zenoh-util", ] [[package]] name = "zenoh-plugin-trait" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ - "const_format", "libloading", "serde", "serde_json", @@ -5140,49 +5461,49 @@ dependencies = [ [[package]] name = "zenoh-protocol" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "const_format", "rand 0.8.5", "serde", "uhlc", "zenoh-buffers", + "zenoh-collections", "zenoh-keyexpr", "zenoh-result", ] [[package]] name = "zenoh-result" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "anyhow", ] [[package]] name = "zenoh-runtime" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ - "futures 0.3.28", + "futures 0.3.30", "lazy_static", "libc", "ron", "serde", "tokio", - "zenoh-collections", "zenoh-macros", "zenoh-result", ] [[package]] name = "zenoh-sync" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ - "event-listener 4.0.0", - "futures 0.3.28", + "event-listener 5.3.1", + "futures 0.3.30", "tokio", "zenoh-buffers", "zenoh-collections", @@ -5192,10 +5513,10 @@ dependencies = [ [[package]] name = "zenoh-task" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ - "futures 0.3.28", + "futures 0.3.30", "tokio", "tokio-util", "tracing", @@ -5205,11 +5526,13 @@ dependencies = [ [[package]] name = "zenoh-transport" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ "async-trait", + "crossbeam-utils", "flume", + "lazy_static", "lz4_flex", "paste", "rand 0.8.5", @@ -5237,11 +5560,11 @@ dependencies = [ [[package]] name = "zenoh-util" -version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#e66745ebdf70f01bf01ba60f69bc902b917b2d24" +version = "1.0.0-dev" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=dev/1.0.0#926208cd2bd9a7ef59e6151ff17a99ce6b78edbd" dependencies = [ - "async-std", "async-trait", + "const_format", "flume", "home", "humantime", @@ -5249,6 +5572,8 @@ dependencies = [ "libc", "libloading", "pnet_datalink", + "serde", + "serde_json", "shellexpand", "tokio", "tracing", @@ -5275,7 +5600,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.33", + "syn 2.0.52", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 32a5361..e49b4e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ members = ["zenoh-bridge-ros1", "zenoh-plugin-ros1", "rosrust/rosrust"] exclude = ["rosrust"] [workspace.package] -version = "0.11.0-dev" +version = "1.0.0-dev" authors = [ "Dmitrii Bannov ", "Luca Cominardi ", @@ -30,7 +30,6 @@ categories = ["network-programming"] [workspace.dependencies] atoi = "2.0.0" -async-std = "=1.12.0" async-trait = "0.1" clap = "3.2.23" ctrlc = "3.2.5" @@ -39,7 +38,7 @@ git-version = "0.3.5" lazy_static = "1.4.0" serde = "1.0.147" serde_derive = "1.0.147" -serde_json = "1.0.85" +serde_json = "1.0.114" async-global-executor = "2.3.1" rand = "0.8.5" strum = "0.24" @@ -49,17 +48,17 @@ flume = "0.11" hex = "0.4.3" xml-rpc = "0.0.12" rustc_version = "0.4" +test-case = { version = "3.3" } +tokio = { version = "1.35.1", features = ["process"] } tracing = "0.1" -zenoh = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = [ +zenoh = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "dev/1.0.0", features = [ + "internal", "unstable", "plugins", ] } -zenoh-ext = { 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-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-plugin-ros1 = { version = "0.11.0-dev", path = "zenoh-plugin-ros1", default-features = false } -zenoh-util = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" } +zenoh-plugin-rest = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "dev/1.0.0", default-features = false } +zenoh-plugin-trait = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "dev/1.0.0", default-features = false } +zenoh-plugin-ros1 = { version = "1.0.0-dev", path = "zenoh-plugin-ros1", default-features = false } [profile.release] debug = false diff --git a/DEFAULT_CONFIG.json5 b/DEFAULT_CONFIG.json5 index 0329cf6..02474ca 100644 --- a/DEFAULT_CONFIG.json5 +++ b/DEFAULT_CONFIG.json5 @@ -118,6 +118,24 @@ //// The string format is [0-9]+(ns|us|ms|[smhdwy]) //// // ros_master_polling_interval: "100ms", + + //// + //// This plugin uses Tokio (https://tokio.rs/) for asynchronous programming. + //// When running as a plugin within a Zenoh router, the plugin creates its own Runtime managing 2 pools of threads: + //// - worker threads for non-blocking tasks. Those threads are spawn at Runtime creation. + //// - blocking threads for blocking tasks (e.g. I/O). Those threads are spawn when needed. + //// For more details see https://github.com/tokio-rs/tokio/discussions/3858#discussioncomment-869878 + //// When running as a standalone bridge the Zenoh Session's Runtime is used and can be configured via the + //// `ZENOH_RUNTIME` environment variable. See https://docs.rs/zenoh-runtime/latest/zenoh_runtime/enum.ZRuntime.html + //// + + //// work_thread_num: The number of worker thread in the asynchronous runtime will use. (default: 2) + //// Only for a plugin, no effect on a bridge. + // work_thread_num: 2, + + //// max_block_thread_num: The number of blocking thread in the asynchronous runtime will use. (default: 50) + //// Only for a plugin, no effect on a bridge. + // max_block_thread_num: 50, }, //// diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 743f7cd..7897a24 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.72.0" +channel = "1.75.0" diff --git a/zenoh-bridge-ros1/Cargo.toml b/zenoh-bridge-ros1/Cargo.toml index 7f3b18b..4ab9043 100644 --- a/zenoh-bridge-ros1/Cargo.toml +++ b/zenoh-bridge-ros1/Cargo.toml @@ -24,17 +24,16 @@ description = "Zenoh bridge for ROS1" publish = false [dependencies] -async-std = { workspace = true, features = ["unstable", "attributes"] } clap = { workspace = true } ctrlc = { workspace = true } tracing = { workspace = true } lazy_static = { workspace = true } serde_json = { workspace = true } +tokio = { workspace = true } zenoh = { workspace = true } zenoh-plugin-trait = { workspace = true } zenoh-plugin-ros1 = { workspace = true } zenoh-plugin-rest = { workspace = true } -zenoh-util = { workspace = true } [[bin]] name = "zenoh-bridge-ros1" path = "src/main.rs" diff --git a/zenoh-bridge-ros1/src/main.rs b/zenoh-bridge-ros1/src/main.rs index 3944256..c7da7dd 100644 --- a/zenoh-bridge-ros1/src/main.rs +++ b/zenoh-bridge-ros1/src/main.rs @@ -11,13 +11,15 @@ // Contributors: // ZettaScale Zenoh Team, // -use async_std::channel::unbounded; -use clap::{App, Arg}; use std::str::FromStr; -use zenoh::config::Config; -use zenoh::plugins::PluginsManager; -use zenoh::prelude::r#async::*; -use zenoh::runtime::RuntimeBuilder; + +use clap::{App, Arg}; +use tokio::sync::mpsc::unbounded_channel; +use zenoh::{ + config::{Config, ZenohId}, + internal::{plugins::PluginsManager, runtime::RuntimeBuilder}, + prelude::*, +}; use zenoh_plugin_ros1::ros_to_zenoh_bridge::environment::Environment; use zenoh_plugin_trait::Plugin; @@ -185,6 +187,16 @@ Bridge polls ROS1 master to get information on local topics. This option is the Accepted value:' A string such as 100ms, 2s, 5m The string format is [0-9]+(ns|us|ms|[smhdwy])"# + )) + .arg(Arg::from_usage( +r#"--work_thread_num=[usize] \ +'The number of worker thread in TOKIO runtime (default: 2) +The configuration only takes effect if running as a dynamic plugin, which can not reuse the current runtime.'"# + )) + .arg(Arg::from_usage( +r#"--max_block_thread_num=[usize] \ +'The number of blocking thread in TOKIO runtime (default: 50) +The configuration only takes effect if running as a dynamic plugin, which can not reuse the current runtime.'"# )); let args = app.get_matches(); @@ -214,13 +226,15 @@ The string format is [0-9]+(ns|us|ms|[smhdwy])"# config .connect .endpoints - .extend(endpoints.map(|p| p.parse().unwrap())) + .set(endpoints.map(|p| p.parse().unwrap()).collect()) + .unwrap(); } if let Some(endpoints) = args.values_of("listen") { config .listen .endpoints - .extend(endpoints.map(|p| p.parse().unwrap())) + .set(endpoints.map(|p| p.parse().unwrap()).collect()) + .unwrap(); } if args.is_present("no-multicast-scouting") { config.scouting.multicast.set_enabled(Some(false)).unwrap(); @@ -248,17 +262,13 @@ The string format is [0-9]+(ns|us|ms|[smhdwy])"# config } -#[async_std::main] +#[tokio::main] async fn main() { - let (sender, receiver) = unbounded(); - ctrlc::set_handler(move || { - sender - .send_blocking(()) - .expect("Error handling Ctrl+C signal") - }) - .expect("Error setting Ctrl+C handler"); + let (sender, mut receiver) = unbounded_channel(); + ctrlc::set_handler(move || sender.send(()).expect("Error handling Ctrl+C signal")) + .expect("Error setting Ctrl+C handler"); - zenoh_util::init_log_from_env_or("z=info"); + zenoh::init_log_from_env_or("z=info"); tracing::info!( "zenoh-bridge-ros1 {}", zenoh_plugin_ros1::Ros1Plugin::PLUGIN_LONG_VERSION diff --git a/zenoh-plugin-ros1/Cargo.toml b/zenoh-plugin-ros1/Cargo.toml index 15cacb0..4bc576f 100644 --- a/zenoh-plugin-ros1/Cargo.toml +++ b/zenoh-plugin-ros1/Cargo.toml @@ -41,6 +41,8 @@ flume = { workspace = true } futures = { workspace = true } git-version = { workspace = true } lazy_static = { workspace = true } +test-case = { workspace = true } +tokio = { workspace = true } tracing = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } @@ -51,10 +53,7 @@ strum = { workspace = true } strum_macros = { workspace = true } duration-string = { workspace = true } zenoh = { workspace = true } -zenoh-ext = { workspace = true } -zenoh-core = { workspace = true } zenoh-plugin-trait = { workspace = true } -zenoh-util = { workspace = true } hex = { workspace = true } xml-rpc = { workspace = true } rosrust = { path = "../rosrust/rosrust" } @@ -66,10 +65,6 @@ ctrlc = { workspace = true } # TODO: https://zettascale.atlassian.net/browse/ZEN-291 # zenoh-plugin-ros1 = { path = ".", features = ["test"]} -[dependencies.async-std] -version = "=1.12.0" -features = ["unstable", "attributes"] - [build-dependencies] rustc_version = { workspace = true } @@ -79,4 +74,4 @@ maintainer = "zenoh-dev@eclipse.org" copyright = "2017, 2022 ZettaScale Technology Inc." section = "net" license-file = ["../LICENSE", "0"] -depends = "zenohd (=0.11.0-dev-1)" +depends = "zenohd (=1.0.0~dev-1)" diff --git a/zenoh-plugin-ros1/examples/ros1_pub.rs b/zenoh-plugin-ros1/examples/ros1_pub.rs index dc3aa00..f89b3b9 100644 --- a/zenoh-plugin-ros1/examples/ros1_pub.rs +++ b/zenoh-plugin-ros1/examples/ros1_pub.rs @@ -12,16 +12,15 @@ // ZettaScale Zenoh Team, // -use zenoh::SessionDeclarations; -use zenoh_core::AsyncResolve; +use zenoh::prelude::*; use zenoh_plugin_ros1::ros_to_zenoh_bridge::{ environment::Environment, ros1_master_ctrl::Ros1MasterCtrl, Ros1ToZenohBridge, }; -#[async_std::main] +#[tokio::main] async fn main() { // initiate logging - zenoh_util::try_init_log_from_env(); + zenoh::try_init_log_from_env(); // You need to have ros1 installed within your system and have "rosmaster" command available, otherwise this code will fail. // start ROS1 master... @@ -54,7 +53,6 @@ async fn main() { // create Zenoh session and subscriber print!("Creating Zenoh Session..."); let zenoh_session = zenoh::open(zenoh::config::default()) - .res_async() .await .unwrap() .into_arc(); @@ -64,7 +62,6 @@ async fn main() { let zenoh_subscriber = zenoh_session .declare_subscriber("some/ros/topic") .callback(|data| println!("Zenoh Subscriber: got data!")) - .res_async() .await .unwrap(); println!(" OK!"); @@ -83,5 +80,5 @@ async fn main() { std::thread::sleep(core::time::Duration::from_secs(1)); } }; - async_std::task::spawn_blocking(working_loop).await; + tokio::task::spawn_blocking(working_loop).await.unwrap(); } diff --git a/zenoh-plugin-ros1/examples/ros1_service.rs b/zenoh-plugin-ros1/examples/ros1_service.rs index 22a0737..e7b2633 100644 --- a/zenoh-plugin-ros1/examples/ros1_service.rs +++ b/zenoh-plugin-ros1/examples/ros1_service.rs @@ -12,17 +12,14 @@ // ZettaScale Zenoh Team, // -use zenoh::prelude::SplitBuffer; -use zenoh_core::AsyncResolve; - use zenoh_plugin_ros1::ros_to_zenoh_bridge::{ environment::Environment, ros1_master_ctrl::Ros1MasterCtrl, Ros1ToZenohBridge, }; -#[async_std::main] +#[tokio::main] async fn main() { // initiate logging - zenoh_util::try_init_log_from_env(); + zenoh::try_init_log_from_env(); // You need to have ros1 installed within your system and have "rosmaster" command available, otherwise this code will fail. // start ROS1 master... @@ -62,7 +59,6 @@ async fn main() { // create Zenoh session print!("Creating Zenoh Session..."); let zenoh_session = zenoh::open(zenoh::config::default()) - .res_async() .await .unwrap() .into_arc(); @@ -77,20 +73,19 @@ async fn main() { println!("Zenoh: sending query..."); let reply = zenoh_session .get("some/ros/topic") - .with_value(data.clone()) - .res_async() + .payload(data.clone()) .await .unwrap(); let result = reply.recv_async().await; match result { Ok(val) => { println!("Zenoh: got reply!"); - assert!(data == val.sample.unwrap().value.payload.contiguous().to_vec()); + assert!(data == val.result().unwrap().payload().into::>()); } Err(e) => { println!("Zenoh got error: {}", e); } } - async_std::task::sleep(core::time::Duration::from_secs(1)).await; + tokio::time::sleep(core::time::Duration::from_secs(1)).await; } } diff --git a/zenoh-plugin-ros1/examples/ros1_standalone_pub.rs b/zenoh-plugin-ros1/examples/ros1_standalone_pub.rs index ba54bc2..8fc6fe8 100644 --- a/zenoh-plugin-ros1/examples/ros1_standalone_pub.rs +++ b/zenoh-plugin-ros1/examples/ros1_standalone_pub.rs @@ -12,22 +12,20 @@ // ZettaScale Zenoh Team, // -use async_std::channel::unbounded; +use tokio::sync::mpsc::unbounded_channel; use zenoh_plugin_ros1::ros_to_zenoh_bridge::environment::Environment; -#[async_std::main] +#[tokio::main] async fn main() { - let (sender, receiver) = unbounded(); + let (sender, mut receiver) = unbounded_channel(); ctrlc::set_handler(move || { tracing::info!("Catching Ctrl+C..."); - sender - .send_blocking(()) - .expect("Error handling Ctrl+C signal") + sender.send(()).expect("Error handling Ctrl+C signal") }) .expect("Error setting Ctrl+C handler"); // initiate logging - zenoh_util::try_init_log_from_env(); + zenoh::try_init_log_from_env(); // create ROS1 node and publisher print!("Creating ROS1 Node..."); @@ -59,5 +57,5 @@ async fn main() { } tracing::info!("Caught Ctrl+C, stopping..."); }; - async_std::task::spawn_blocking(working_loop).await; + tokio::task::spawn_blocking(working_loop).await.unwrap(); } diff --git a/zenoh-plugin-ros1/examples/ros1_standalone_sub.rs b/zenoh-plugin-ros1/examples/ros1_standalone_sub.rs index bf4ea9e..3f254a2 100644 --- a/zenoh-plugin-ros1/examples/ros1_standalone_sub.rs +++ b/zenoh-plugin-ros1/examples/ros1_standalone_sub.rs @@ -12,23 +12,20 @@ // ZettaScale Zenoh Team, // -use async_std::channel::unbounded; - +use tokio::sync::mpsc::unbounded_channel; use zenoh_plugin_ros1::ros_to_zenoh_bridge::environment::Environment; -#[async_std::main] +#[tokio::main] async fn main() { - let (sender, receiver) = unbounded(); + let (sender, mut receiver) = unbounded_channel(); ctrlc::set_handler(move || { tracing::info!("Catching Ctrl+C..."); - sender - .send_blocking(()) - .expect("Error handling Ctrl+C signal") + sender.send(()).expect("Error handling Ctrl+C signal") }) .expect("Error setting Ctrl+C handler"); // initiate logging - zenoh_util::try_init_log_from_env(); + zenoh::try_init_log_from_env(); // create ROS1 node and subscriber print!("Creating ROS1 Node..."); diff --git a/zenoh-plugin-ros1/examples/ros1_sub.rs b/zenoh-plugin-ros1/examples/ros1_sub.rs index a5aba54..7b857b7 100644 --- a/zenoh-plugin-ros1/examples/ros1_sub.rs +++ b/zenoh-plugin-ros1/examples/ros1_sub.rs @@ -12,17 +12,15 @@ // ZettaScale Zenoh Team, // -use zenoh::SessionDeclarations; -use zenoh_core::AsyncResolve; - +use zenoh::prelude::*; use zenoh_plugin_ros1::ros_to_zenoh_bridge::{ environment::Environment, ros1_master_ctrl::Ros1MasterCtrl, Ros1ToZenohBridge, }; -#[async_std::main] +#[tokio::main] async fn main() { // initiate logging - zenoh_util::try_init_log_from_env(); + zenoh::try_init_log_from_env(); // You need to have ros1 installed within your system and have "rosmaster" command available, otherwise this code will fail. // start ROS1 master... @@ -57,17 +55,12 @@ async fn main() { // create Zenoh session and publisher print!("Creating Zenoh Session..."); - let zenoh_session = zenoh::open(zenoh::config::peer()) - .res_async() - .await - .unwrap() - .into_arc(); + let zenoh_session = zenoh::open(zenoh::config::peer()).await.unwrap().into_arc(); println!(" OK!"); print!("Creating Zenoh Publisher..."); let zenoh_publisher = zenoh_session .declare_publisher("some/ros/topic") - .congestion_control(zenoh::publication::CongestionControl::Block) - .res_async() + .congestion_control(zenoh::qos::CongestionControl::Block) .await .unwrap(); println!(" OK!"); @@ -79,7 +72,7 @@ async fn main() { let data: Vec = (0..10).collect(); loop { println!("Zenoh Publisher: publishing data..."); - zenoh_publisher.put(data.clone()).res_async().await.unwrap(); - async_std::task::sleep(core::time::Duration::from_secs(1)).await; + zenoh_publisher.put(data.clone()).await.unwrap(); + tokio::time::sleep(core::time::Duration::from_secs(1)).await; } } diff --git a/zenoh-plugin-ros1/src/lib.rs b/zenoh-plugin-ros1/src/lib.rs index 311ae75..34911e8 100644 --- a/zenoh-plugin-ros1/src/lib.rs +++ b/zenoh-plugin-ros1/src/lib.rs @@ -13,18 +13,91 @@ // #![recursion_limit = "1024"] -use ros_to_zenoh_bridge::environment::Environment; -use ros_to_zenoh_bridge::ros1_master_ctrl::Ros1MasterCtrl; -use ros_to_zenoh_bridge::Ros1ToZenohBridge; -use std::time::Duration; -use zenoh::plugins::{RunningPlugin, RunningPluginTrait, ZenohPlugin}; -use zenoh::prelude::r#async::*; -use zenoh::runtime::Runtime; -use zenoh::Result as ZResult; +use std::{ + future::Future, + sync::atomic::{AtomicUsize, Ordering}, + time::Duration, +}; + +use ros_to_zenoh_bridge::{ + environment::Environment, ros1_master_ctrl::Ros1MasterCtrl, Ros1ToZenohBridge, +}; +use tokio::task::JoinHandle; +use zenoh::{ + internal::{ + plugins::{RunningPlugin, RunningPluginTrait, ZenohPlugin}, + runtime::Runtime, + }, + Result as ZResult, +}; use zenoh_plugin_trait::{plugin_long_version, plugin_version, Plugin, PluginControl}; +use crate::ros_to_zenoh_bridge::environment; + pub mod ros_to_zenoh_bridge; +lazy_static::lazy_static! { + static ref WORK_THREAD_NUM: AtomicUsize = AtomicUsize::new(environment::DEFAULT_WORK_THREAD_NUM); + static ref MAX_BLOCK_THREAD_NUM: AtomicUsize = AtomicUsize::new(environment::DEFAULT_MAX_BLOCK_THREAD_NUM); + // The global runtime is used in the dynamic plugins, which we can't get the current runtime + static ref TOKIO_RUNTIME: tokio::runtime::Runtime = tokio::runtime::Builder::new_multi_thread() + .worker_threads(WORK_THREAD_NUM.load(Ordering::SeqCst)) + .max_blocking_threads(MAX_BLOCK_THREAD_NUM.load(Ordering::SeqCst)) + .enable_all() + .build() + .expect("Unable to create runtime"); +} +#[inline(always)] +pub(crate) fn spawn_blocking_runtime(func: F) -> JoinHandle +where + F: FnOnce() -> R + Send + 'static, + R: Send + 'static, +{ + // Check whether able to get the current runtime + match tokio::runtime::Handle::try_current() { + Ok(rt) => { + // Able to get the current runtime (standalone binary), use the current runtime + rt.spawn_blocking(func) + } + Err(_) => { + // Unable to get the current runtime (dynamic plugins), reuse the global runtime + TOKIO_RUNTIME.spawn_blocking(func) + } + } +} +#[inline(always)] +pub(crate) fn spawn_runtime(task: F) -> JoinHandle +where + F: Future + Send + 'static, + F::Output: Send + 'static, +{ + // Check whether able to get the current runtime + match tokio::runtime::Handle::try_current() { + Ok(rt) => { + // Able to get the current runtime (standalone binary), use the current runtime + rt.spawn(task) + } + Err(_) => { + // Unable to get the current runtime (dynamic plugins), reuse the global runtime + TOKIO_RUNTIME.spawn(task) + } + } +} +#[inline(always)] +pub(crate) fn blockon_runtime(task: F) -> F::Output { + // Check whether able to get the current runtime + match tokio::runtime::Handle::try_current() { + Ok(rt) => { + // Able to get the current runtime (standalone binary), use the current runtime + tokio::task::block_in_place(|| rt.block_on(task)) + } + Err(_) => { + // Unable to get the current runtime (dynamic plugins), reuse the global runtime + tokio::task::block_in_place(|| TOKIO_RUNTIME.block_on(task)) + } + } +} + // The struct implementing the ZenohPlugin and ZenohPlugin traits pub struct Ros1Plugin {} @@ -47,7 +120,7 @@ impl Plugin for Ros1Plugin { // Try to initiate login. // Required in case of dynamic lib, otherwise no logs. // But cannot be done twice in case of static link. - zenoh_util::try_init_log_from_env(); + zenoh::try_init_log_from_env(); tracing::debug!("ROS1 plugin {}", Ros1Plugin::PLUGIN_LONG_VERSION); let config = runtime.config().lock(); @@ -66,6 +139,9 @@ impl Plugin for Ros1Plugin { entry.set(str.trim_matches('"').to_string()); } } + // Setup the thread numbers + WORK_THREAD_NUM.store(Environment::work_thread_num().get(), Ordering::SeqCst); + MAX_BLOCK_THREAD_NUM.store(Environment::max_block_thread_num().get(), Ordering::SeqCst); drop(config); @@ -83,20 +159,20 @@ impl RunningPluginTrait for Ros1PluginInstance {} impl Drop for Ros1PluginInstance { fn drop(&mut self) { if Environment::with_rosmaster().get() { - async_std::task::block_on(Ros1MasterCtrl::without_ros1_master()); + blockon_runtime(Ros1MasterCtrl::without_ros1_master()); } } } impl Ros1PluginInstance { fn new(runtime: &Runtime) -> ZResult { - let bridge: ZResult = async_std::task::block_on(async { + let bridge: ZResult = blockon_runtime(async { if Environment::with_rosmaster().get() { Ros1MasterCtrl::with_ros1_master().await?; - async_std::task::sleep(Duration::from_secs(1)).await; + tokio::time::sleep(Duration::from_secs(1)).await; } // create a zenoh Session that shares the same Runtime as zenohd - let session = zenoh::init(runtime.clone()).res().await?.into_arc(); + let session = zenoh::session::init(runtime.clone()).await?.into_arc(); let bridge = ros_to_zenoh_bridge::Ros1ToZenohBridge::new_with_external_session(session); Ok(bridge) }); diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge.rs index 4bebd75..9a37dda 100644 --- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge.rs +++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge.rs @@ -12,18 +12,17 @@ // ZettaScale Zenoh Team, // -use async_std::task::JoinHandle; - -use tracing::error; -use zenoh; -use zenoh_core::{zresult::ZResult, AsyncResolve}; - use std::sync::{ atomic::{AtomicBool, Ordering::Relaxed}, Arc, }; +use tokio::task::JoinHandle; +use tracing::error; +use zenoh::{self, Result as ZResult, Session}; + use self::{environment::Environment, ros1_to_zenoh_bridge_impl::work_cycle}; +use crate::spawn_runtime; #[cfg(feature = "test")] pub mod aloha_declaration; @@ -89,15 +88,15 @@ pub struct Ros1ToZenohBridge { } impl Ros1ToZenohBridge { pub async fn new_with_own_session(config: zenoh::config::Config) -> ZResult { - let session = zenoh::open(config).res_async().await?.into_arc(); + let session = zenoh::open(config).await?.into_arc(); Ok(Self::new_with_external_session(session)) } - pub fn new_with_external_session(session: Arc) -> Self { + pub fn new_with_external_session(session: Arc) -> Self { let flag = Arc::new(AtomicBool::new(true)); Self { flag: flag.clone(), - task_handle: Box::new(async_std::task::spawn(Self::run(session, flag))), + task_handle: Box::new(spawn_runtime(Self::run(session, flag))), } } @@ -107,7 +106,7 @@ impl Ros1ToZenohBridge { } //PRIVATE: - async fn run(session: Arc, flag: Arc) { + async fn run(session: Arc, flag: Arc) { if let Err(e) = work_cycle( Environment::ros_master_uri().get().as_str(), session, @@ -122,7 +121,10 @@ impl Ros1ToZenohBridge { } async fn async_await(&mut self) { - self.task_handle.as_mut().await; + self.task_handle + .as_mut() + .await + .expect("Unable to complete the task"); } } impl Drop for Ros1ToZenohBridge { diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/abstract_bridge.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/abstract_bridge.rs index cf500fd..087a1be 100644 --- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/abstract_bridge.rs +++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/abstract_bridge.rs @@ -14,18 +14,15 @@ use std::sync::Arc; -use tracing::{debug, error, info}; - use rosrust::RawMessageDescription; -use zenoh::buffers::buffer::SplitBuffer; -use zenoh::key_expr::keyexpr; -use zenoh_core::Result as ZResult; -use zenoh_core::{AsyncResolve, SyncResolve}; +use tracing::{debug, error, info}; +use zenoh::{internal::bail, key_expr::keyexpr, prelude::*, Result as ZResult}; use super::{ bridge_type::BridgeType, ros1_client, topic_descriptor::TopicDescriptor, topic_utilities::make_zenoh_key, zenoh_client, }; +use crate::{blockon_runtime, spawn_blocking_runtime, spawn_runtime}; pub struct AbstractBridge { _impl: BridgeIml, @@ -85,7 +82,7 @@ impl Ros1ToZenohClient { ) { Ok(service) => Ok(Ros1ToZenohClient { _service: service }), Err(e) => { - zenoh_core::bail!("Ros error: {}", e) + bail!("Ros error: {}", e) } } } @@ -96,7 +93,7 @@ impl Ros1ToZenohClient { query: rosrust::RawMessage, zenoh_client: &zenoh_client::ZenohClient, ) -> rosrust::ServiceResult { - return async_std::task::block_on(Self::do_zenoh_query(key, query, zenoh_client)); + return blockon_runtime(Self::do_zenoh_query(key, query, zenoh_client)); } async fn do_zenoh_query( @@ -106,18 +103,18 @@ impl Ros1ToZenohClient { ) -> rosrust::ServiceResult { match zenoh_client.make_query_sync(key, query.0).await { Ok(reply) => match reply.recv_async().await { - Ok(r) => match r.sample { - Ok(value) => { - let data = value.payload.contiguous().to_vec(); + Ok(r) => match r.result() { + Ok(sample) => { + let data = sample.payload().into::>(); debug!("Zenoh -> ROS1: sending {} bytes!", data.len()); Ok(rosrust::RawMessage(data)) } Err(e) => { + let error = format!("{:?}", e); error!( - "ROS1 -> Zenoh Client: received Zenoh Query with error: {}", - e + "ROS1 -> Zenoh Client: received Zenoh Query with error: {:?}", + error ); - let error = e.to_string(); Err(error) } }, @@ -143,7 +140,7 @@ impl Ros1ToZenohClient { } struct Ros1ToZenohService { - _queryable: zenoh::queryable::Queryable<'static, ()>, + _queryable: zenoh::query::Queryable<'static, ()>, } impl Ros1ToZenohService { async fn new<'b>( @@ -162,7 +159,7 @@ impl Ros1ToZenohService { let topic_in_arc = Arc::new(topic.clone()); let queryable = zenoh_client .make_queryable(make_zenoh_key(topic), move |query| { - async_std::task::spawn(Self::on_query( + spawn_runtime(Self::on_query( client_in_arc.clone(), query, topic_in_arc.clone(), @@ -174,7 +171,7 @@ impl Ros1ToZenohService { }) } Err(e) => { - zenoh_core::bail!("Ros error: {}", e.to_string()) + bail!("Ros error: {}", e.to_string()) } } } @@ -182,12 +179,12 @@ impl Ros1ToZenohService { //PRIVATE: async fn on_query( ros1_client: Arc>, - query: zenoh::queryable::Query, + query: zenoh::query::Query, topic: Arc, ) { - match query.value() { + match query.payload() { Some(val) => { - let payload = val.payload.contiguous().to_vec(); + let payload = val.into::>(); debug!( "ROS1 -> Zenoh Service: got query of {} bytes!", payload.len() @@ -202,13 +199,13 @@ impl Ros1ToZenohService { async fn process_query( ros1_client: Arc>, - query: zenoh::queryable::Query, + query: zenoh::query::Query, payload: Vec, topic: Arc, ) { // rosrust is synchronous, so we will use spawn_blocking. If there will be an async mode some day for the rosrust, // than reply_to_query can be refactored to async very easily - let res = async_std::task::spawn_blocking(move || { + let res = spawn_blocking_runtime(move || { let description = RawMessageDescription { msg_definition: String::from("*"), md5sum: topic.md5.clone(), @@ -216,7 +213,8 @@ impl Ros1ToZenohService { }; ros1_client.req_with_description(&rosrust::RawMessage(payload), description) }) - .await; + .await + .expect("Unable to compete the task"); match Self::reply_to_query(res, &query).await { Ok(_) => {} Err(e) => { @@ -231,7 +229,7 @@ impl Ros1ToZenohService { async fn reply_to_query( res: rosrust::error::tcpros::Result>, - query: &zenoh::queryable::Query, + query: &zenoh::query::Query, ) -> ZResult<()> { match res { Ok(reply) => match reply { @@ -241,11 +239,7 @@ impl Ros1ToZenohService { reply_message.0.len() ); query - .reply(Ok(zenoh::prelude::Sample::new( - query.key_expr().clone(), - reply_message.0, - ))) - .res_async() + .reply(query.key_expr().clone(), reply_message.0) .await?; } Err(e) => { @@ -253,10 +247,7 @@ impl Ros1ToZenohService { "ROS1 -> Zenoh Service: got reply from ROS1 Service with error: {}", e ); - query - .reply(Err(zenoh::prelude::Value::from(e))) - .res_async() - .await?; + query.reply(query.key_expr().clone(), e).await?; } }, Err(e) => { @@ -265,10 +256,7 @@ impl Ros1ToZenohService { e ); let error = e.to_string(); - query - .reply(Err(zenoh::prelude::Value::from(error))) - .res_async() - .await?; + query.reply(query.key_expr().clone(), error).await?; } } Ok(()) @@ -292,7 +280,7 @@ impl Ros1ToZenoh { let publisher = zenoh_client.publish(make_zenoh_key(topic)).await?; match ros1_client.subscribe(topic, move |msg: rosrust::RawMessage| { debug!("ROS1 -> Zenoh: sending {} bytes!", msg.0.len()); - match publisher.put(msg.0).res_sync() { + match publisher.put(msg.0).wait() { Ok(_) => {} Err(e) => { error!("ROS1 -> Zenoh: error publishing: {}", e); @@ -303,14 +291,14 @@ impl Ros1ToZenoh { _subscriber: subscriber, }), Err(e) => { - zenoh_core::bail!("Ros error: {}", e.to_string()) + bail!("Ros error: {}", e.to_string()) } } } } struct ZenohToRos1 { - _subscriber: zenoh::subscriber::Subscriber<'static, ()>, + _subscriber: zenoh::pubsub::Subscriber<'static, ()>, } impl ZenohToRos1 { async fn new( @@ -329,8 +317,8 @@ impl ZenohToRos1 { let subscriber = zenoh_client .subscribe(make_zenoh_key(topic), move |sample| { let publisher_in_arc_cloned = publisher_in_arc.clone(); - async_std::task::spawn_blocking(move || { - let data = sample.value.payload.contiguous().to_vec(); + spawn_blocking_runtime(move || { + let data = sample.payload().into::>(); debug!("Zenoh -> ROS1: sending {} bytes!", data.len()); match publisher_in_arc_cloned.send(rosrust::RawMessage(data)) { Ok(_) => {} @@ -346,7 +334,7 @@ impl ZenohToRos1 { }) } Err(e) => { - zenoh_core::bail!("Ros error: {}", e.to_string()) + bail!("Ros error: {}", e.to_string()) } } } diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/aloha_declaration.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/aloha_declaration.rs index 1784eca..739af75 100644 --- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/aloha_declaration.rs +++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/aloha_declaration.rs @@ -12,14 +12,25 @@ // ZettaScale Zenoh Team, // -use zenoh::buffers::ZBuf; +use std::{ + sync::{ + atomic::{AtomicBool, AtomicUsize}, + Arc, + }, + time::Duration, +}; -use std::sync::atomic::{AtomicBool, AtomicUsize}; -use std::sync::Arc; -use std::time::Duration; +use zenoh::{ + internal::buffers::ZBuf, + key_expr::OwnedKeyExpr, + prelude::*, + pubsub::Reliability, + qos::{CongestionControl, Priority}, + sample::Locality, + Session, +}; -use zenoh::prelude::r#async::*; -use zenoh::Session; +use crate::spawn_runtime; pub struct AlohaDeclaration { monitor_running: Arc, @@ -33,7 +44,7 @@ impl Drop for AlohaDeclaration { impl AlohaDeclaration { pub fn new(session: Arc, key: OwnedKeyExpr, beacon_period: Duration) -> Self { let monitor_running = Arc::new(AtomicBool::new(true)); - async_std::task::spawn(Self::aloha_monitor_task( + spawn_runtime(Self::aloha_monitor_task( beacon_period, monitor_running.clone(), key, @@ -60,7 +71,6 @@ impl AlohaDeclaration { .callback(move |_| { rb.fetch_add(1, std::sync::atomic::Ordering::SeqCst); }) - .res_async() .await .unwrap(); @@ -79,10 +89,8 @@ impl AlohaDeclaration { // start publisher in ALOHA style... let period_ns = beacon_period.as_nanos(); let aloha_wait: u128 = rand::random::() % period_ns; - async_std::task::sleep(Duration::from_nanos( - aloha_wait.try_into().unwrap(), - )) - .await; + tokio::time::sleep(Duration::from_nanos(aloha_wait.try_into().unwrap())) + .await; if remote_beacons.load(std::sync::atomic::Ordering::SeqCst) == 0 { Self::start_beacon_task( beacon_period, @@ -101,7 +109,7 @@ impl AlohaDeclaration { } } } - async_std::task::sleep(beacon_period).await; + tokio::time::sleep(beacon_period).await; } Self::stop_beacon_task(beacon_task_flag.clone()); } @@ -113,7 +121,7 @@ impl AlohaDeclaration { running: Arc, ) { running.store(true, std::sync::atomic::Ordering::SeqCst); - async_std::task::spawn(Self::aloha_publishing_task( + spawn_runtime(Self::aloha_publishing_task( beacon_period, key, session, @@ -136,16 +144,12 @@ impl AlohaDeclaration { .allowed_destination(Locality::Remote) .congestion_control(CongestionControl::Drop) .priority(Priority::Background) - .res_async() .await .unwrap(); while running.load(std::sync::atomic::Ordering::Relaxed) { - let _res = publisher - .put(zenoh::value::Value::new(ZBuf::default())) - .res_async() - .await; - async_std::task::sleep(beacon_period).await; + let _res = publisher.put(ZBuf::default()).await; + tokio::time::sleep(beacon_period).await; } } } diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/aloha_subscription.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/aloha_subscription.rs index 32bb5a3..daf2032 100644 --- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/aloha_subscription.rs +++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/aloha_subscription.rs @@ -21,12 +21,13 @@ use std::{ time::Duration, }; -use async_std::sync::Mutex; use flume::Receiver; use futures::{join, Future, FutureExt}; +use tokio::sync::Mutex; use tracing::error; -use zenoh::prelude::r#async::*; -use zenoh_core::Result as ZResult; +use zenoh::{key_expr::OwnedKeyExpr, prelude::*, sample::Sample, Result as ZResult, Session}; + +use crate::spawn_runtime; struct AlohaResource { activity: AtomicBool, @@ -81,7 +82,7 @@ impl AlohaSubscription { { let task_running = Arc::new(AtomicBool::new(true)); - async_std::task::spawn(AlohaSubscription::task( + spawn_runtime(AlohaSubscription::task( task_running.clone(), key, beacon_period, @@ -109,7 +110,7 @@ impl AlohaSubscription { + 'static, { let accumulating_resources = Mutex::new(HashMap::::new()); - let subscriber = session.declare_subscriber(key).res_async().await?; + let subscriber = session.declare_subscriber(key).await?; let listen = Self::listening_task( task_running.clone(), @@ -135,7 +136,7 @@ impl AlohaSubscription { async fn listening_task<'a, F>( task_running: Arc, accumulating_resources: &Mutex>, - subscriber: &'a zenoh::subscriber::Subscriber<'a, Receiver>, + subscriber: &'a zenoh::pubsub::Subscriber<'a, Receiver>, on_resource_declared: &F, ) where F: Fn(zenoh::key_expr::KeyExpr) -> Box + Unpin + Send> @@ -148,7 +149,7 @@ impl AlohaSubscription { Ok(val) => match accumulating_resources .lock() .await - .entry(val.key_expr.into()) + .entry(val.key_expr().as_keyexpr().into()) { Occupied(mut val) => { val.get_mut().update(); @@ -185,7 +186,7 @@ impl AlohaSubscription { val.1.reset(); }); - async_std::task::sleep(accumulate_period).await; + tokio::time::sleep(accumulate_period).await; for (key, val) in accumulating_resources.lock().await.iter() { if !val.is_active() { diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/discovery.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/discovery.rs index 9093979..4d3e66e 100644 --- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/discovery.rs +++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/discovery.rs @@ -12,26 +12,28 @@ // ZettaScale Zenoh Team, // +use std::{str, sync::Arc, time::Duration}; + use futures::Future; use tracing::error; -use zenoh_core::bail; - -use std::sync::Arc; -use std::time::Duration; - -use zenoh::prelude::r#async::*; - -use std::str; - -use super::aloha_declaration::AlohaDeclaration; -use super::aloha_subscription::{AlohaSubscription, AlohaSubscriptionBuilder}; -use super::bridge_type::BridgeType; -use super::topic_descriptor::TopicDescriptor; -use super::topic_utilities::{make_topic, make_topic_key}; - +use zenoh::{ + internal::bail, + key_expr::{ + format::{kedefine, keformat}, + KeyExpr, + }, +}; + +use super::{ + aloha_declaration::AlohaDeclaration, + aloha_subscription::{AlohaSubscription, AlohaSubscriptionBuilder}, + bridge_type::BridgeType, + topic_descriptor::TopicDescriptor, + topic_utilities::{make_topic, make_topic_key}, +}; use crate::ZResult; -zenoh::kedefine!( +kedefine!( pub discovery_format: "ros1_discovery_info/${discovery_namespace:*}/${resource_class:*}/${data_type:*}/${md5:*}/${bridge_namespace:*}/${topic:**}", ); // example: @@ -65,7 +67,7 @@ impl RemoteResources { { // make proper discovery keyexpr let mut formatter = discovery_format::formatter(); - let discovery_keyexpr = zenoh::keformat!( + let discovery_keyexpr = keformat!( formatter, discovery_namespace = discovery_namespace, resource_class = "*", @@ -185,7 +187,7 @@ impl LocalResource { ) -> ZResult { // make proper discovery keyexpr let mut formatter = discovery_format::formatter(); - let discovery_keyexpr = zenoh::keformat!( + let discovery_keyexpr = keformat!( formatter, discovery_namespace = discovery_namespace, resource_class = resource_class, diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/environment.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/environment.rs index 7ac1b2c..c6885a2 100644 --- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/environment.rs +++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/environment.rs @@ -12,16 +12,17 @@ // ZettaScale Zenoh Team, // +use std::{collections::HashMap, convert::From, marker::PhantomData, str::FromStr, time::Duration}; + use duration_string::DurationString; use rosrust::api::resolve::*; -use std::collections::HashMap; -use std::convert::From; -use std::time::Duration; -use std::{marker::PhantomData, str::FromStr}; use tracing::error; use super::bridging_mode::BridgingMode; +pub(crate) const DEFAULT_WORK_THREAD_NUM: usize = 2; +pub(crate) const DEFAULT_MAX_BLOCK_THREAD_NUM: usize = 50; + #[derive(Clone)] pub struct Entry<'a, Tvar> where @@ -82,6 +83,12 @@ impl<'a> From> for Entry<'a, String> { } } +impl<'a> From> for Entry<'a, String> { + fn from(item: Entry<'a, usize>) -> Entry<'a, String> { + Entry::new(item.name, item.default.to_string()) + } +} + #[derive(Clone, Default)] pub struct CustomBridgingModes { pub modes: HashMap, @@ -171,8 +178,16 @@ impl Environment { ); } + pub fn work_thread_num() -> Entry<'static, usize> { + return Entry::new("WORK_THREAD_NUM", DEFAULT_WORK_THREAD_NUM); + } + + pub fn max_block_thread_num() -> Entry<'static, usize> { + return Entry::new("MAX_BLOCK_THREAD_NUM", DEFAULT_MAX_BLOCK_THREAD_NUM); + } + pub fn env() -> Vec> { - return [ + [ Self::ros_master_uri(), Self::ros_hostname(), Self::ros_name(), @@ -187,7 +202,9 @@ impl Environment { Self::client_topic_custom_bridging_mode().into(), Self::master_polling_interval().into(), Self::with_rosmaster().into(), + Self::work_thread_num().into(), + Self::max_block_thread_num().into(), ] - .to_vec(); + .to_vec() } } diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/resource_cache.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/resource_cache.rs index 463aae3..b55d155 100644 --- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/resource_cache.rs +++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/resource_cache.rs @@ -12,17 +12,20 @@ // ZettaScale Zenoh Team, // -use rosrust::{Publisher, RawMessage, RawMessageDescription}; use std::{ collections::{hash_map::Entry, HashMap}, net::{TcpStream, ToSocketAddrs}, sync::{Arc, Mutex}, time::Duration, }; -use zenoh_core::{bail, zerror, zresult::ZResult}; + +use rosrust::{Publisher, RawMessage, RawMessageDescription, RosMsg}; +use zenoh::{ + internal::{bail, zerror}, + Result as ZResult, +}; use super::{ros1_client::Ros1Client, topic_descriptor::TopicDescriptor}; -use rosrust::RosMsg; pub type TopicName = String; pub type NodeName = String; diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/ros1_client.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/ros1_client.rs index e12a808..9aa7331 100644 --- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/ros1_client.rs +++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/ros1_client.rs @@ -14,7 +14,7 @@ use rosrust::{self, RawMessageDescription}; use tracing::debug; -use zenoh_core::{zerror, zresult::ZResult}; +use zenoh::{internal::zerror, Result as ZResult}; use super::topic_descriptor::TopicDescriptor; diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/ros1_master_ctrl.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/ros1_master_ctrl.rs index 69477dc..25e2a95 100644 --- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/ros1_master_ctrl.rs +++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/ros1_master_ctrl.rs @@ -12,18 +12,22 @@ // ZettaScale Zenoh Team, // -use async_std::{ +use atoi::atoi; +use tokio::{ process::{Child, Command}, sync::Mutex, }; -use atoi::atoi; use tracing::error; -use zenoh_core::Result as ZResult; -use zenoh_core::{bail, zasynclock, zerror}; +use zenoh::{ + internal::{bail, zasynclock, zerror}, + Result as ZResult, +}; use crate::ros_to_zenoh_bridge::environment::Environment; -static ROSMASTER: Mutex> = Mutex::new(None); +lazy_static::lazy_static! { + static ref ROSMASTER: Mutex> = Mutex::new(None); +} pub struct Ros1MasterCtrl; impl Ros1MasterCtrl { @@ -53,20 +57,12 @@ impl Ros1MasterCtrl { let mut locked = zasynclock!(ROSMASTER); assert!(locked.is_some()); match locked.take() { - Some(mut child) => match child.kill() { - Ok(_) => { - if let Err(e) = child.status().await { - error!("Error stopping child rosmaster: {}", e); - } - } + Some(mut child) => match child.kill().await { + Ok(_) => {} Err(e) => error!("Error sending kill cmd to child rosmaster: {}", e), }, None => match Command::new("killall").arg("rosmaster").spawn() { - Ok(mut child) => { - if let Err(e) = child.status().await { - error!("Error stopping foreign rosmaster: {}", e); - } - } + Ok(_) => {} Err(e) => error!( "Error executing killall command to stop foreign rosmaster: {}", e diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/ros1_to_zenoh_bridge_impl.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/ros1_to_zenoh_bridge_impl.rs index 1347bee..c1f2e89 100644 --- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/ros1_to_zenoh_bridge_impl.rs +++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/ros1_to_zenoh_bridge_impl.rs @@ -12,11 +12,6 @@ // ZettaScale Zenoh Team, // -use async_std::sync::Mutex; - -use zenoh; -use zenoh_core::{zasynclock, zresult::ZResult}; - use std::{ sync::{ atomic::{AtomicBool, Ordering::Relaxed}, @@ -25,18 +20,22 @@ use std::{ time::Duration, }; +use tokio::sync::Mutex; use tracing::{debug, error}; - -use crate::ros_to_zenoh_bridge::{ - bridges_storage::BridgesStorage, discovery::LocalResources, environment::Environment, - ros1_client, topic_mapping, zenoh_client, -}; +use zenoh::{self, internal::zasynclock, Result as ZResult}; use super::{ discovery::{RemoteResources, RemoteResourcesBuilder}, resource_cache::Ros1ResourceCache, ros1_client::Ros1Client, }; +use crate::{ + ros_to_zenoh_bridge::{ + bridges_storage::BridgesStorage, discovery::LocalResources, environment::Environment, + ros1_client, topic_mapping, zenoh_client, + }, + spawn_blocking_runtime, +}; #[derive(PartialEq, Clone, Copy)] pub enum RosStatus { @@ -174,7 +173,7 @@ where while flag.load(Relaxed) { let cl = ros1_client.clone(); - let (ros1_state, returned_cache) = async_std::task::spawn_blocking(move || { + let (ros1_state, returned_cache) = spawn_blocking_runtime(move || { ( topic_mapping::Ros1TopicMapping::topic_mapping( cl.as_ref(), @@ -183,7 +182,8 @@ where ros1_resource_cache, ) }) - .await; + .await + .expect("Unable to complete the task"); ros1_resource_cache = returned_cache; debug!("ros state: {:#?}", ros1_state); @@ -199,7 +199,7 @@ where self.report_bridge_statistics(&locked); } - async_std::task::sleep({ + tokio::time::sleep({ if smth_changed { poll_interval / 2 } else { @@ -217,7 +217,7 @@ where Self::cleanup(&mut locked); self.report_bridge_statistics(&locked); } - async_std::task::sleep(poll_interval).await; + tokio::time::sleep(poll_interval).await; } } } diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/test_helpers.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/test_helpers.rs index 671e979..91c80db 100644 --- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/test_helpers.rs +++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/test_helpers.rs @@ -12,32 +12,40 @@ // ZettaScale Zenoh Team, // -use async_std::prelude::FutureExt; +use std::{ + net::SocketAddr, + process::Command, + str::FromStr, + sync::{ + atomic::{AtomicBool, AtomicU16, AtomicUsize, Ordering::*}, + Arc, Mutex, RwLock, + }, + time::Duration, +}; + use async_trait::async_trait; use futures::Future; use rosrust::{Client, RawMessage, RawMessageDescription}; -use std::process::Command; -use std::sync::atomic::AtomicBool; -use std::sync::atomic::AtomicUsize; -use std::sync::atomic::Ordering::*; -use std::sync::{Arc, Mutex, RwLock}; -use std::time::Duration; -use std::{net::SocketAddr, str::FromStr, sync::atomic::AtomicU16}; use tracing::error; -use zenoh::config::ModeDependentValue; -use zenoh::prelude::OwnedKeyExpr; -use zenoh::prelude::SplitBuffer; -use zenoh::sample::Sample; -use zenoh::Session; -use zenoh::SessionDeclarations; -use zenoh_core::{bail, zlock, zresult::ZResult, AsyncResolve, SyncResolve}; - -use super::discovery::LocalResources; -use super::ros1_to_zenoh_bridge_impl::{work_cycle, BridgeStatus, RosStatus}; -use super::topic_descriptor::TopicDescriptor; -use super::topic_utilities; -use super::topic_utilities::make_topic_key; -use super::{ros1_client, zenoh_client}; +use zenoh::{ + config::ModeDependentValue, + internal::{bail, zlock}, + key_expr::OwnedKeyExpr, + prelude::*, + sample::Sample, + Result as ZResult, Session, +}; + +use super::{ + discovery::LocalResources, + ros1_client, + ros1_to_zenoh_bridge_impl::{work_cycle, BridgeStatus, RosStatus}, + topic_descriptor::TopicDescriptor, + topic_utilities, + topic_utilities::make_topic_key, + zenoh_client, +}; +use crate::{spawn_blocking_runtime, spawn_runtime}; pub struct IsolatedPort { pub port: u16, @@ -110,7 +118,7 @@ where if waiter() { return true; } - async_std::task::sleep(Duration::from_millis(sleep_millis)).await; + tokio::time::sleep(Duration::from_millis(sleep_millis)).await; } false } @@ -122,10 +130,10 @@ where { let w = async { while !waiter().await { - async_std::task::sleep(Duration::from_millis(10)).await + tokio::time::sleep(Duration::from_millis(10)).await } }; - w.timeout(timeout).await.is_ok() + tokio::time::timeout(timeout, w).await.is_ok() } pub struct RunningBridge { @@ -142,7 +150,7 @@ impl RunningBridge { ros_status: Arc::new(Mutex::new(RosStatus::Unknown)), bridge_status: Arc::new(Mutex::new(BridgeStatus::default())), }; - async_std::task::spawn(Self::run( + spawn_runtime(Self::run( ros_master_uri, config, result.flag.clone(), @@ -159,7 +167,7 @@ impl RunningBridge { ros_status: Arc>, bridge_status: Arc>, ) { - let session = zenoh::open(config).res_async().await.unwrap().into_arc(); + let session = zenoh::open(config).await.unwrap().into_arc(); work_cycle( ros_master_uri.as_str(), session, @@ -291,7 +299,7 @@ pub struct BridgeChecker { impl BridgeChecker { // PUBLIC pub fn new(config: zenoh::config::Config, ros_master_uri: &str) -> BridgeChecker { - let session = zenoh::open(config).res_sync().unwrap().into_arc(); + let session = zenoh::open(config).wait().unwrap().into_arc(); BridgeChecker { session: session.clone(), ros_client: ros1_client::Ros1Client::new("test_ros_node", ros_master_uri).unwrap(), @@ -309,8 +317,7 @@ impl BridgeChecker { } async fn wait_for_zenoh_peers(&self, peer_count: usize, timeout: Duration) -> bool { - let waiter = - || async { self.session.info().peers_zid().res_async().await.count() == peer_count }; + let waiter = || async { self.session.info().peers_zid().await.count() == peer_count }; wait_async(waiter, timeout).await } @@ -318,7 +325,7 @@ impl BridgeChecker { &self, name: &str, callback: C, - ) -> zenoh::subscriber::Subscriber<'static, ()> + ) -> zenoh::pubsub::Subscriber<'static, ()> where C: Fn(Sample) + Send + Sync + 'static, { @@ -328,7 +335,7 @@ impl BridgeChecker { .unwrap() } - pub async fn make_zenoh_publisher(&self, name: &str) -> zenoh::publication::Publisher<'static> { + pub async fn make_zenoh_publisher(&self, name: &str) -> zenoh::pubsub::Publisher<'static> { self.zenoh_client .publish(Self::make_zenoh_key(&Self::make_topic(name))) .await @@ -339,9 +346,9 @@ impl BridgeChecker { &self, name: &str, callback: Callback, - ) -> zenoh::queryable::Queryable<'static, ()> + ) -> zenoh::query::Queryable<'static, ()> where - Callback: Fn(zenoh::queryable::Query) + Send + Sync + 'static, + Callback: Fn(zenoh::query::Query) + Send + Sync + 'static, { self.zenoh_client .make_queryable(Self::make_zenoh_key(&Self::make_topic(name)), callback) @@ -512,7 +519,7 @@ impl TestParams { } pub struct ZenohPublisher { - pub inner: Arc>, + pub inner: Arc>, } pub struct ROS1Publisher { pub inner: Arc>>, @@ -537,9 +544,9 @@ impl ZenohQuery { async fn make_query(inner: &Arc, key: &str, data: &Vec) -> ZResult<()> { let query = inner.make_zenoh_query_sync(key, data.clone()).await; match query.recv_async().await { - Ok(reply) => match reply.sample { - Ok(value) => { - let returned_data = value.payload.contiguous().to_vec(); + Ok(reply) => match reply.result() { + Ok(sample) => { + let returned_data = sample.payload().into::>(); if data.eq(&returned_data) { Ok(()) } else { @@ -547,7 +554,7 @@ impl ZenohQuery { } } Err(e) => { - bail!("ZenohQuery: got reply with error: {}", e); + bail!("ZenohQuery: got reply with error: {:?}", e); } }, Err(e) => { @@ -661,16 +668,14 @@ pub trait Publisher: Sync { impl Publisher for ZenohPublisher { fn put(&self, data: Vec) { let inner = self.inner.clone(); - async_std::task::spawn_blocking(move || inner.put(data).res_sync().unwrap()); + spawn_blocking_runtime(move || inner.put(data).wait().unwrap()); } } #[async_trait] impl Publisher for ROS1Publisher { fn put(&self, data: Vec) { let inner = self.inner.clone(); - async_std::task::spawn_blocking(move || { - inner.data.send(rosrust::RawMessage(data)).unwrap() - }); + spawn_blocking_runtime(move || inner.data.send(rosrust::RawMessage(data)).unwrap()); } async fn ready(&self) -> bool { @@ -680,7 +685,7 @@ impl Publisher for ROS1Publisher { #[async_trait] impl Publisher for ZenohQuery { fn put(&self, data: Vec) { - async_std::task::spawn(Self::query_loop( + spawn_runtime(Self::query_loop( self.inner.clone(), self.key.clone(), self.running.clone(), @@ -708,7 +713,7 @@ impl Publisher for ROS1Client { msg_type: self.topic.datatype.clone(), }; - async_std::task::spawn_blocking(|| { + spawn_blocking_runtime(|| { Self::query_loop(description, running, data, cycles, ros1_client) }); } @@ -721,18 +726,17 @@ impl Publisher for ROS1Client { }; let data = (0..10).collect(); let ros1_client = self.ros1_client.clone(); - async_std::task::spawn_blocking(move || { - Self::make_query(description, &data, &ros1_client).is_ok() - }) - .await + spawn_blocking_runtime(move || Self::make_query(description, &data, &ros1_client).is_ok()) + .await + .unwrap_or(false) } } pub struct ZenohSubscriber { - pub _inner: zenoh::subscriber::Subscriber<'static, ()>, + pub _inner: zenoh::pubsub::Subscriber<'static, ()>, } pub struct ZenohQueryable { - pub _inner: zenoh::queryable::Queryable<'static, ()>, + pub _inner: zenoh::query::Queryable<'static, ()>, } pub struct ROS1Subscriber { pub inner: RAIICounter, diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/topic_bridge.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/topic_bridge.rs index 6d175da..1f04892 100644 --- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/topic_bridge.rs +++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/topic_bridge.rs @@ -12,6 +12,10 @@ // ZettaScale Zenoh Team, // +use std::{fmt::Display, sync::Arc}; + +use tracing::error; + use super::{ abstract_bridge::AbstractBridge, bridge_type::BridgeType, @@ -21,8 +25,6 @@ use super::{ topic_descriptor::TopicDescriptor, zenoh_client, }; -use std::{fmt::Display, sync::Arc}; -use tracing::error; pub struct TopicBridge { topic: TopicDescriptor, diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/topic_mapping.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/topic_mapping.rs index c58acdf..0776d5a 100644 --- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/topic_mapping.rs +++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/topic_mapping.rs @@ -14,9 +14,8 @@ use std::collections::HashSet; -use crate::ros_to_zenoh_bridge::ros1_client; - use super::{resource_cache::Ros1ResourceCache, topic_descriptor::TopicDescriptor}; +use crate::ros_to_zenoh_bridge::ros1_client; #[derive(Debug)] pub struct Ros1TopicMapping { diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/topic_utilities.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/topic_utilities.rs index 93fe6f5..dcf58cd 100644 --- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/topic_utilities.rs +++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/topic_utilities.rs @@ -12,11 +12,14 @@ // ZettaScale Zenoh Team, // -use zenoh::prelude::{keyexpr, OwnedKeyExpr}; +use zenoh::key_expr::{ + format::{kedefine, keformat}, + keyexpr, OwnedKeyExpr, +}; use super::topic_descriptor::TopicDescriptor; -zenoh::kedefine!( +kedefine!( pub ros_mapping_format: "${data_type:*}/${md5:*}/${topic:**}", ); @@ -26,7 +29,7 @@ pub fn make_topic_key(topic: &TopicDescriptor) -> &str { pub fn make_zenoh_key(topic: &TopicDescriptor) -> OwnedKeyExpr { let mut formatter = ros_mapping_format::formatter(); - zenoh::keformat!( + keformat!( formatter, data_type = hex::encode(topic.datatype.as_bytes()), md5 = topic.md5.clone(), diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/zenoh_client.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/zenoh_client.rs index b7483ed..1dcd0cf 100644 --- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/zenoh_client.rs +++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/zenoh_client.rs @@ -12,14 +12,18 @@ // ZettaScale Zenoh Team, // -use std::fmt::Display; -use std::sync::Arc; +use std::{fmt::Display, sync::Arc}; use tracing::debug; - -use zenoh::prelude::r#async::*; -use zenoh::Session; -pub use zenoh_core::zresult::ZResult; +use zenoh::{ + key_expr::KeyExpr, + prelude::*, + pubsub::Reliability, + qos::CongestionControl, + query::Selector, + sample::{Locality, Sample}, + Result as ZResult, Session, +}; pub struct ZenohClient { session: Arc, @@ -35,7 +39,7 @@ impl ZenohClient { &self, key_expr: TryIntoKeyExpr, callback: C, - ) -> ZResult> + ) -> ZResult> where C: Fn(Sample) + Send + Sync + 'static, TryIntoKeyExpr: TryInto> + Display, @@ -48,14 +52,13 @@ impl ZenohClient { .callback(callback) .allowed_origin(Locality::Remote) .reliability(Reliability::Reliable) - .res_async() .await } pub async fn publish<'b: 'static, TryIntoKeyExpr>( &self, key_expr: TryIntoKeyExpr, - ) -> ZResult> + ) -> ZResult> where TryIntoKeyExpr: TryInto> + Display, >>::Error: Into, @@ -66,7 +69,6 @@ impl ZenohClient { .declare_publisher(key_expr) .allowed_destination(Locality::Remote) .congestion_control(CongestionControl::Block) - .res_async() .await } @@ -74,9 +76,9 @@ impl ZenohClient { &self, key_expr: TryIntoKeyExpr, callback: Callback, - ) -> ZResult> + ) -> ZResult> where - Callback: Fn(zenoh::queryable::Query) + Send + Sync + 'static, + Callback: Fn(zenoh::query::Query) + Send + Sync + 'static, TryIntoKeyExpr: TryInto> + Display, >>::Error: Into, { @@ -86,7 +88,6 @@ impl ZenohClient { .declare_queryable(key_expr) .allowed_origin(Locality::Remote) .callback(callback) - .res_async() .await } @@ -106,10 +107,9 @@ impl ZenohClient { self.session .get(selector) - .with_value(data) + .payload(data) .callback(callback) .allowed_destination(Locality::Remote) - .res_async() .await } @@ -126,9 +126,8 @@ impl ZenohClient { self.session .get(selector) - .with_value(data) + .payload(data) .allowed_destination(Locality::Remote) - .res_async() .await } } diff --git a/zenoh-plugin-ros1/tests/aloha_declaration_test.rs b/zenoh-plugin-ros1/tests/aloha_declaration_test.rs index 52fa7e2..88db5bb 100644 --- a/zenoh-plugin-ros1/tests/aloha_declaration_test.rs +++ b/zenoh-plugin-ros1/tests/aloha_declaration_test.rs @@ -19,9 +19,9 @@ use std::{ time::Duration, }; -use async_std::{prelude::FutureExt, sync::Mutex}; -use zenoh::{prelude::OwnedKeyExpr, OpenBuilder, Session, SessionDeclarations}; -use zenoh_core::{AsyncResolve, Result as ZResult, SyncResolve}; +use test_case::test_case; +use tokio::sync::Mutex; +use zenoh::{key_expr::OwnedKeyExpr, prelude::*, session::OpenBuilder, Result as ZResult, Session}; use zenoh_plugin_ros1::ros_to_zenoh_bridge::{ aloha_declaration, aloha_subscription, test_helpers::IsolatedConfig, }; @@ -55,25 +55,28 @@ fn subscription_builder( } fn make_session(cfg: &IsolatedConfig) -> Arc { - session_builder(cfg).res_sync().unwrap().into_arc() + session_builder(cfg).wait().unwrap().into_arc() } -fn make_subscription( +async fn make_subscription( session: Arc, beacon_period: Duration, ) -> aloha_subscription::AlohaSubscription { - async_std::task::block_on(subscription_builder(session, beacon_period).build()).unwrap() + subscription_builder(session, beacon_period) + .build() + .await + .expect("Failed to make subscription") } -#[test] -fn aloha_instantination_one_instance() { +#[tokio::test(flavor = "multi_thread")] +async fn aloha_instantination_one_instance() { let session = make_session(&IsolatedConfig::default()); let _declaration = declaration_builder(session.clone(), Duration::from_secs(1)); - let _subscription = make_subscription(session, Duration::from_secs(1)); + let _subscription = make_subscription(session, Duration::from_secs(1)).await; } -#[test] -fn aloha_instantination_many_instances() { +#[tokio::test(flavor = "multi_thread")] +async fn aloha_instantination_many_instances() { let cfg = IsolatedConfig::default(); let mut sessions = Vec::new(); let mut declarations = Vec::new(); @@ -85,12 +88,12 @@ fn aloha_instantination_many_instances() { } for session in sessions.iter() { - subscriptions.push(make_subscription(session.clone(), Duration::from_secs(1))); + subscriptions.push(make_subscription(session.clone(), Duration::from_secs(1)).await); } } pub struct PPCMeasurement<'a> { - _subscriber: zenoh::subscriber::Subscriber<'a, ()>, + _subscriber: zenoh::pubsub::Subscriber<'a, ()>, ppc: Arc, measurement_period: Duration, } @@ -107,7 +110,6 @@ impl<'a> PPCMeasurement<'a> { .callback(move |_val| { p.fetch_add(1, std::sync::atomic::Ordering::SeqCst); }) - .res_async() .await?; Ok(Self { @@ -119,7 +121,7 @@ impl<'a> PPCMeasurement<'a> { pub async fn measure_ppc(&self) -> usize { self.ppc.store(0, std::sync::atomic::Ordering::SeqCst); - async_std::task::sleep(self.measurement_period).await; + tokio::time::sleep(self.measurement_period).await; self.ppc.load(std::sync::atomic::Ordering::SeqCst) } } @@ -186,7 +188,7 @@ impl DeclarationCollector { || !self.to_be_undeclared.lock().await.is_empty() || expected != *self.resources.lock().await { - async_std::task::sleep(core::time::Duration::from_millis(1)).await; + tokio::time::sleep(core::time::Duration::from_millis(1)).await; } } } @@ -238,7 +240,7 @@ async fn test_state_transition<'a>( while declarations.len() < state.declarators_count { if declaring_sessions.len() <= declarations.len() { - declaring_sessions.push(session_builder(cfg).res_async().await.unwrap().into_arc()); + declaring_sessions.push(session_builder(cfg).await.unwrap().into_arc()); } declarations.push(declaration_builder( declaring_sessions[declarations.len()].clone(), @@ -247,7 +249,7 @@ async fn test_state_transition<'a>( } collector.wait(result).await; - async_std::task::sleep(beacon_period).await; + tokio::time::sleep(beacon_period).await; while ppc_measurer.measure_ppc().await != { let mut res = 1; if state.declarators_count == 0 { @@ -263,7 +265,7 @@ async fn run_aloha(beacon_period: Duration, scenario: Vec) { let mut declarations: Vec = Vec::new(); let mut collector = DeclarationCollector::new(); - let subscription_session = session_builder(&cfg).res_async().await.unwrap().into_arc(); + let subscription_session = session_builder(&cfg).await.unwrap().into_arc(); let _subscriber = collector .use_builder(subscription_builder( subscription_session.clone(), @@ -277,99 +279,48 @@ async fn run_aloha(beacon_period: Duration, scenario: Vec) { .unwrap(); for scene in scenario { println!("Transiting State: {}", scene.declarators_count); - test_state_transition( - &cfg, - beacon_period, - &mut declaring_sessions, - &mut declarations, - &mut collector, - &ppc_measurer, - &scene, + tokio::time::timeout( + TIMEOUT, + test_state_transition( + &cfg, + beacon_period, + &mut declaring_sessions, + &mut declarations, + &mut collector, + &ppc_measurer, + &scene, + ), ) - .timeout(TIMEOUT) .await .expect("Timeout waiting state transition!"); } } -#[test] -fn aloha_declare_one() { - async_std::task::block_on(run_aloha( - Duration::from_millis(100), - [State::default().declarators(1)].into_iter().collect(), - )); -} - -#[test] -fn aloha_declare_many() { - async_std::task::block_on(run_aloha( - Duration::from_millis(100), - [State::default().declarators(10)].into_iter().collect(), - )); -} - -#[test] -fn aloha_declare_many_one_many() { - async_std::task::block_on(run_aloha( - Duration::from_millis(100), - [ - State::default().declarators(10), - State::default().declarators(1), - State::default().declarators(10), - ] - .into_iter() - .collect(), - )); -} - -#[test] -fn aloha_declare_one_zero_one() { - async_std::task::block_on(run_aloha( - Duration::from_millis(100), - [ - State::default().declarators(1), - State::default().declarators(0), - State::default().declarators(1), - ] - .into_iter() - .collect(), - )); -} - -#[test] -fn aloha_declare_many_zero_many() { - async_std::task::block_on(run_aloha( - Duration::from_millis(100), - [ - State::default().declarators(10), - State::default().declarators(0), - State::default().declarators(10), - ] - .into_iter() - .collect(), - )); -} - -#[test] -fn aloha_many_scenarios() { - async_std::task::block_on(run_aloha( - Duration::from_millis(100), - [ - State::default().declarators(1), - State::default().declarators(10), - State::default().declarators(1), - State::default().declarators(10), - State::default().declarators(1), - State::default().declarators(10), - State::default().declarators(0), - State::default().declarators(1), - State::default().declarators(10), - State::default().declarators(1), - State::default().declarators(0), - State::default().declarators(10), - State::default().declarators(1), - ] - .into_iter() - .collect(), - )); +#[test_case([State::default().declarators(1)].into_iter().collect(); "one")] +#[test_case([State::default().declarators(10)].into_iter().collect(); "many")] +#[test_case([State::default().declarators(10), + State::default().declarators(1), + State::default().declarators(10)].into_iter().collect(); "many one many")] +#[test_case([State::default().declarators(1), + State::default().declarators(0), + State::default().declarators(1)].into_iter().collect(); "one zero one")] +#[test_case([State::default().declarators(10), + State::default().declarators(0), + State::default().declarators(10)].into_iter().collect(); "many zero many")] +#[test_case([State::default().declarators(1), + State::default().declarators(10), + State::default().declarators(1), + State::default().declarators(10), + State::default().declarators(1), + State::default().declarators(10), + State::default().declarators(0), + State::default().declarators(1), + State::default().declarators(10), + State::default().declarators(1), + State::default().declarators(0), + State::default().declarators(10), + State::default().declarators(1)].into_iter().collect(); "many scenarios")] +#[tokio::test(flavor = "multi_thread")] +async fn aloha_declare(vec_state: Vec) { + run_aloha(Duration::from_millis(100), vec_state).await; } diff --git a/zenoh-plugin-ros1/tests/bridge_to_bridge.rs b/zenoh-plugin-ros1/tests/bridge_to_bridge.rs index 700e6f5..326326b 100644 --- a/zenoh-plugin-ros1/tests/bridge_to_bridge.rs +++ b/zenoh-plugin-ros1/tests/bridge_to_bridge.rs @@ -12,24 +12,26 @@ // ZettaScale Zenoh Team, // -use std::sync::Arc; -use std::time::Duration; -use std::{collections::HashSet, sync::atomic::AtomicU64}; +use std::{ + collections::HashSet, + sync::{ + atomic::{AtomicU64, AtomicUsize, Ordering::*}, + Arc, + }, + time::Duration, +}; -use async_std::prelude::FutureExt; use rosrust::RawMessage; -use std::sync::atomic::{AtomicUsize, Ordering::*}; use strum_macros::Display; +use test_case::test_case; use tracing::{debug, trace}; -use zenoh::prelude::{KeyExpr, OwnedKeyExpr}; -use zenoh_plugin_ros1::ros_to_zenoh_bridge::test_helpers::{ - self, wait_async, Publisher, Subscriber, -}; +use zenoh::key_expr::{KeyExpr, OwnedKeyExpr}; use zenoh_plugin_ros1::ros_to_zenoh_bridge::{ bridging_mode::BridgingMode, environment::Environment, test_helpers::{ - BridgeChecker, IsolatedConfig, IsolatedROSMaster, ROSEnvironment, RunningBridge, TestParams, + self, wait_async, BridgeChecker, IsolatedConfig, IsolatedROSMaster, Publisher, + ROSEnvironment, RunningBridge, Subscriber, TestParams, }, }; @@ -134,9 +136,9 @@ async fn async_create_bridge() { system1.wait_state_synch().await; } -#[test] -fn create_bridge() { - async_std::task::block_on(async_create_bridge()); +#[tokio::test(flavor = "multi_thread")] +async fn create_bridge() { + async_create_bridge().await; } async fn async_create_bridge_and_init() { @@ -145,9 +147,9 @@ async fn async_create_bridge_and_init() { system1.with_ros().with_bridge().wait_state_synch().await; } -#[test] -fn create_bridge_and_init() { - async_std::task::block_on(async_create_bridge_and_init()); +#[tokio::test(flavor = "multi_thread")] +async fn create_bridge_and_init() { + async_create_bridge_and_init().await; } async fn async_create_bridge_and_reinit_ros() { @@ -161,9 +163,9 @@ async fn async_create_bridge_and_reinit_ros() { } } -#[test] -fn create_bridge_and_reinit_ros() { - async_std::task::block_on(async_create_bridge_and_reinit_ros()); +#[tokio::test(flavor = "multi_thread")] +async fn create_bridge_and_reinit_ros() { + async_create_bridge_and_reinit_ros().await; } async fn async_create_bridge_and_reinit_bridge() { @@ -177,9 +179,9 @@ async fn async_create_bridge_and_reinit_bridge() { } } -#[test] -fn create_bridge_and_reinit_bridge() { - async_std::task::block_on(async_create_bridge_and_reinit_bridge()); +#[tokio::test(flavor = "multi_thread")] +async fn create_bridge_and_reinit_bridge() { + async_create_bridge_and_reinit_bridge().await; } struct SrcDstPair { @@ -212,13 +214,12 @@ impl SrcDstPair { async fn start_ping_pong(&self) -> bool { debug!("Starting ping-pong!"); - let mut data = Vec::new(); - data.reserve(TestParams::data_size() as usize); + let mut data = Vec::with_capacity(TestParams::data_size() as usize); for i in 0..TestParams::data_size() { data.push((i % 255) as u8); } - async { + tokio::time::timeout(Duration::from_secs(30), async { while { self.src.put(data.clone()); !test_helpers::wait_async_fn( @@ -229,8 +230,7 @@ impl SrcDstPair { } { debug!("Restarting ping-pong!"); } - } - .timeout(Duration::from_secs(30)) + }) .await .is_ok() } @@ -253,7 +253,7 @@ impl SrcDstPair { self.counter.store(0, Relaxed); while !(result > 0.0 || duration >= 10000) { - async_std::task::sleep(core::time::Duration::from_millis(duration_milliseconds)).await; + tokio::time::sleep(core::time::Duration::from_millis(duration_milliseconds)).await; duration += duration_milliseconds; result += self.counter.load(Relaxed) as f64; } @@ -317,8 +317,6 @@ async fn async_bridge_2_bridge(instances: u32, mode: std::collections::HashSet) { + async_bridge_2_bridge(instances, mode).await; } diff --git a/zenoh-plugin-ros1/tests/discovery_test.rs b/zenoh-plugin-ros1/tests/discovery_test.rs index 7576edb..73c1feb 100644 --- a/zenoh-plugin-ros1/tests/discovery_test.rs +++ b/zenoh-plugin-ros1/tests/discovery_test.rs @@ -17,10 +17,9 @@ use std::{ time::Duration, }; -use async_std::prelude::FutureExt; use multiset::HashMultiSet; -use zenoh::{prelude::keyexpr, OpenBuilder, Session}; -use zenoh_core::{AsyncResolve, SyncResolve}; +use test_case::test_case; +use zenoh::{key_expr::keyexpr, prelude::*, session::OpenBuilder, Session}; use zenoh_plugin_ros1::ros_to_zenoh_bridge::{ discovery::{self, LocalResources, RemoteResources}, test_helpers::{BridgeChecker, IsolatedConfig}, @@ -38,25 +37,25 @@ fn remote_resources_builder(session: Arc) -> discovery::RemoteResources } fn make_session(cfg: &IsolatedConfig) -> Arc { - session_builder(cfg).res_sync().unwrap().into_arc() + session_builder(cfg).wait().unwrap().into_arc() } fn make_local_resources(session: Arc) -> LocalResources { LocalResources::new("*".to_owned(), "*".to_owned(), session) } -fn make_remote_resources(session: Arc) -> RemoteResources { - async_std::task::block_on(remote_resources_builder(session).build()) +async fn make_remote_resources(session: Arc) -> RemoteResources { + remote_resources_builder(session).build().await } -#[test] -fn discovery_instantination_one_instance() { +#[tokio::test(flavor = "multi_thread")] +async fn discovery_instantination_one_instance() { let session = make_session(&IsolatedConfig::default()); - let _remote = make_remote_resources(session.clone()); + let _remote = make_remote_resources(session.clone()).await; let _local = make_local_resources(session); } -#[test] -fn discovery_instantination_many_instances() { +#[tokio::test(flavor = "multi_thread")] +async fn discovery_instantination_many_instances() { let cfg = IsolatedConfig::default(); let mut sessions = Vec::new(); for _i in 0..10 { @@ -65,7 +64,7 @@ fn discovery_instantination_many_instances() { let mut discoveries = Vec::new(); for session in sessions.iter() { - let remote = make_remote_resources(session.clone()); + let remote = make_remote_resources(session.clone()).await; let local = make_local_resources(session.clone()); discoveries.push((remote, local)); } @@ -160,7 +159,7 @@ impl DiscoveryCollector { expected: HashMultiSet, ) { while expected != *container.lock().unwrap() { - async_std::task::sleep(core::time::Duration::from_millis(10)).await; + tokio::time::sleep(core::time::Duration::from_millis(10)).await; } } } @@ -281,128 +280,57 @@ async fn test_state_transition( async fn run_discovery(scenario: Vec) { let cfg = IsolatedConfig::default(); - let src_session = session_builder(&cfg).res_async().await.unwrap().into_arc(); + let src_session = session_builder(&cfg).await.unwrap().into_arc(); let local_resources = make_local_resources(src_session.clone()); let rcv = DiscoveryCollector::new(); - let rcv_session = session_builder(&cfg).res_async().await.unwrap().into_arc(); + let rcv_session = session_builder(&cfg).await.unwrap().into_arc(); let _rcv_discovery = rcv .use_builder(remote_resources_builder(rcv_session)) .build() .await; for scene in scenario { - test_state_transition(&local_resources, &rcv, &scene) - .timeout(TIMEOUT) - .await - .expect("Timeout waiting state transition!"); + tokio::time::timeout( + TIMEOUT, + test_state_transition(&local_resources, &rcv, &scene), + ) + .await + .expect("Timeout waiting state transition!"); } } -#[test] -fn discover_single_publisher() { - async_std::task::block_on(run_discovery( - [State::default().publishers(1, 1)].into_iter().collect(), - )); -} -#[test] -fn discover_single_subscriber() { - async_std::task::block_on(run_discovery( - [State::default().subscribers(1, 1)].into_iter().collect(), - )); -} -#[test] -fn discover_single_service() { - async_std::task::block_on(run_discovery( - [State::default().services(1, 1)].into_iter().collect(), - )); -} -#[test] -fn discover_single_client() { - async_std::task::block_on(run_discovery( - [State::default().clients(1, 1)].into_iter().collect(), - )); -} -#[test] -fn discover_single_transition() { - async_std::task::block_on(run_discovery( - [ - State::default().publishers(1, 1), - State::default().subscribers(1, 1), - State::default().services(1, 1), - State::default().clients(1, 1), - ] - .into_iter() - .collect(), - )); -} -#[test] -fn discover_single_transition_with_zero_state() { - async_std::task::block_on(run_discovery( - [ - State::default().publishers(1, 1), - State::default(), - State::default().subscribers(1, 1), - State::default(), - State::default().services(1, 1), - State::default(), - State::default().clients(1, 1), - ] - .into_iter() - .collect(), - )); -} - -#[test] -fn discover_multiple_publishers() { - async_std::task::block_on(run_discovery( - [State::default().publishers(100, 1)].into_iter().collect(), - )); -} -#[test] -fn discover_multiple_subscribers() { - async_std::task::block_on(run_discovery( - [State::default().subscribers(100, 1)].into_iter().collect(), - )); -} -#[test] -fn discover_multiple_services() { - async_std::task::block_on(run_discovery( - [State::default().services(100, 1)].into_iter().collect(), - )); -} -#[test] -fn discover_multiple_clients() { - async_std::task::block_on(run_discovery( - [State::default().clients(100, 1)].into_iter().collect(), - )); -} -#[test] -fn discover_multiple_transition() { - async_std::task::block_on(run_discovery( - [ - State::default().publishers(100, 1), - State::default().subscribers(100, 1), - State::default().services(100, 1), - State::default().clients(100, 1), - ] - .into_iter() - .collect(), - )); -} -#[test] -fn discover_multiple_transition_with_zero_state() { - async_std::task::block_on(run_discovery( - [ - State::default().publishers(100, 1), - State::default(), - State::default().subscribers(100, 1), - State::default(), - State::default().services(100, 1), - State::default(), - State::default().clients(100, 1), - ] - .into_iter() - .collect(), - )); +#[test_case([State::default().publishers(1, 1)].into_iter().collect(); "single_publisher")] +#[test_case([State::default().subscribers(1, 1)].into_iter().collect(); "single_subscriber")] +#[test_case([State::default().services(1, 1)].into_iter().collect(); "single_service")] +#[test_case([State::default().clients(1, 1)].into_iter().collect(); "single_client")] +#[test_case([State::default().publishers(1, 1), + State::default().subscribers(1, 1), + State::default().services(1, 1), + State::default().clients(1, 1),].into_iter().collect(); "single_transition")] +#[test_case([State::default().publishers(1, 1), + State::default(), + State::default().subscribers(1, 1), + State::default(), + State::default().services(1, 1), + State::default(), + State::default().clients(1, 1),].into_iter().collect(); "single_transition_with_zero_state")] +#[test_case([State::default().publishers(100, 1)].into_iter().collect(); "multiple_publisher")] +#[test_case([State::default().subscribers(100, 1)].into_iter().collect(); "multiple_subscriber")] +#[test_case([State::default().services(100, 1)].into_iter().collect(); "multiple_service")] +#[test_case([State::default().clients(100, 1)].into_iter().collect(); "multiple_client")] +#[test_case([State::default().publishers(100, 1), + State::default().subscribers(100, 1), + State::default().services(100, 1), + State::default().clients(100, 1),].into_iter().collect(); "multiple_transition")] +#[test_case([State::default().publishers(100, 1), + State::default(), + State::default().subscribers(100, 1), + State::default(), + State::default().services(100, 1), + State::default(), + State::default().clients(100, 1),].into_iter().collect(); "multiple_transition_with_zero_state")] +#[tokio::test(flavor = "multi_thread")] +async fn discover(vec_state: Vec) { + run_discovery(vec_state).await; } diff --git a/zenoh-plugin-ros1/tests/ping_pong_test.rs b/zenoh-plugin-ros1/tests/ping_pong_test.rs index c39150e..17eb216 100644 --- a/zenoh-plugin-ros1/tests/ping_pong_test.rs +++ b/zenoh-plugin-ros1/tests/ping_pong_test.rs @@ -12,130 +12,120 @@ // ZettaScale Zenoh Team, // -use async_std::prelude::FutureExt; -use strum_macros::Display; -use zenoh::prelude::SplitBuffer; -use zenoh_core::SyncResolve; - use std::{ collections::HashSet, sync::{ - atomic::{AtomicBool, AtomicU64, Ordering::*}, + atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering::*}, Arc, }, + thread, time, time::Duration, }; +use strum_macros::Display; +use tracing::{debug, trace}; +use zenoh::{key_expr::KeyExpr, prelude::*}; use zenoh_plugin_ros1::ros_to_zenoh_bridge::{ bridging_mode::BridgingMode, + discovery::LocalResource, environment::Environment, test_helpers::{ - self, wait_async_fn, BridgeChecker, Publisher, ROS1Client, ROS1Publisher, ROS1Service, - ROS1Subscriber, ROSEnvironment, RunningBridge, Subscriber, TestParams, ZenohPublisher, - ZenohQuery, ZenohQueryable, ZenohSubscriber, + self, wait_async_fn, BridgeChecker, IsolatedConfig, IsolatedROSMaster, Publisher, + ROS1Client, ROS1Publisher, ROS1Service, ROS1Subscriber, ROSEnvironment, RunningBridge, + Subscriber, TestParams, ZenohPublisher, ZenohQuery, ZenohQueryable, ZenohSubscriber, }, }; -use zenoh_plugin_ros1::ros_to_zenoh_bridge::{ - discovery::LocalResource, - test_helpers::{IsolatedConfig, IsolatedROSMaster}, -}; - -use std::sync::atomic::AtomicUsize; -use tracing::{debug, trace}; -use zenoh::prelude::r#async::*; - -use std::{thread, time}; -#[test] -fn env_checks_no_master_init_and_exit_immed() { +#[tokio::test(flavor = "multi_thread")] +async fn env_checks_no_master_init_and_exit_immed() { let roscfg = IsolatedROSMaster::default(); let _ros_env = ROSEnvironment::new(roscfg.port.port); let bridge = RunningBridge::new(IsolatedConfig::default().peer(), roscfg.master_uri()); - async_std::task::block_on(bridge.assert_ros_error()); - async_std::task::block_on(bridge.assert_bridge_empy()); + bridge.assert_ros_error().await; + bridge.assert_bridge_empy().await; } -#[test] -fn env_checks_no_master_init_and_wait() { +#[tokio::test(flavor = "multi_thread")] +async fn env_checks_no_master_init_and_wait() { let roscfg = IsolatedROSMaster::default(); let _ros_env = ROSEnvironment::new(roscfg.port.port); let bridge = RunningBridge::new(IsolatedConfig::default().peer(), roscfg.master_uri()); - async_std::task::block_on(bridge.assert_ros_error()); - async_std::task::block_on(bridge.assert_bridge_empy()); + bridge.assert_ros_error().await; + bridge.assert_bridge_empy().await; thread::sleep(time::Duration::from_secs(1)); - async_std::task::block_on(bridge.assert_ros_error()); - async_std::task::block_on(bridge.assert_bridge_empy()); + bridge.assert_ros_error().await; + bridge.assert_bridge_empy().await; } -#[test] -fn env_checks_with_master_init_and_exit_immed() { +#[tokio::test(flavor = "multi_thread")] +async fn env_checks_with_master_init_and_exit_immed() { let roscfg = IsolatedROSMaster::default(); let _ros_env = ROSEnvironment::new(roscfg.port.port).with_master(); let bridge = RunningBridge::new(IsolatedConfig::default().peer(), roscfg.master_uri()); - async_std::task::block_on(bridge.assert_ros_ok()); - async_std::task::block_on(bridge.assert_bridge_empy()); + bridge.assert_ros_ok().await; + bridge.assert_bridge_empy().await; } -#[test] -fn env_checks_with_master_init_and_wait() { +#[tokio::test(flavor = "multi_thread")] +async fn env_checks_with_master_init_and_wait() { let roscfg = IsolatedROSMaster::default(); let _ros_env = ROSEnvironment::new(roscfg.port.port).with_master(); let bridge = RunningBridge::new(IsolatedConfig::default().peer(), roscfg.master_uri()); - async_std::task::block_on(bridge.assert_ros_ok()); - async_std::task::block_on(bridge.assert_bridge_empy()); + bridge.assert_ros_ok().await; + bridge.assert_bridge_empy().await; thread::sleep(time::Duration::from_secs(1)); - async_std::task::block_on(bridge.assert_ros_ok()); - async_std::task::block_on(bridge.assert_bridge_empy()); + bridge.assert_ros_ok().await; + bridge.assert_bridge_empy().await; } -#[test] -fn env_checks_with_master_init_and_loose_master() { +#[tokio::test(flavor = "multi_thread")] +async fn env_checks_with_master_init_and_loose_master() { let roscfg = IsolatedROSMaster::default(); let mut _ros_env = Some(ROSEnvironment::new(roscfg.port.port).with_master()); let bridge = RunningBridge::new(IsolatedConfig::default().peer(), roscfg.master_uri()); - async_std::task::block_on(bridge.assert_ros_ok()); - async_std::task::block_on(bridge.assert_bridge_empy()); + bridge.assert_ros_ok().await; + bridge.assert_bridge_empy().await; thread::sleep(time::Duration::from_secs(1)); - async_std::task::block_on(bridge.assert_ros_ok()); - async_std::task::block_on(bridge.assert_bridge_empy()); + bridge.assert_ros_ok().await; + bridge.assert_bridge_empy().await; _ros_env = None; - async_std::task::block_on(bridge.assert_ros_error()); - async_std::task::block_on(bridge.assert_bridge_empy()); + bridge.assert_ros_error().await; + bridge.assert_bridge_empy().await; thread::sleep(time::Duration::from_secs(1)); - async_std::task::block_on(bridge.assert_ros_error()); - async_std::task::block_on(bridge.assert_bridge_empy()); + bridge.assert_ros_error().await; + bridge.assert_bridge_empy().await; } -#[test] -fn env_checks_with_master_init_and_wait_for_master() { +#[tokio::test(flavor = "multi_thread")] +async fn env_checks_with_master_init_and_wait_for_master() { let roscfg = IsolatedROSMaster::default(); let mut _ros_env = ROSEnvironment::new(roscfg.port.port); let bridge = RunningBridge::new(IsolatedConfig::default().peer(), roscfg.master_uri()); - async_std::task::block_on(bridge.assert_ros_error()); - async_std::task::block_on(bridge.assert_bridge_empy()); + bridge.assert_ros_error().await; + bridge.assert_bridge_empy().await; thread::sleep(time::Duration::from_secs(1)); - async_std::task::block_on(bridge.assert_ros_error()); - async_std::task::block_on(bridge.assert_bridge_empy()); + bridge.assert_ros_error().await; + bridge.assert_bridge_empy().await; _ros_env = _ros_env.with_master(); - async_std::task::block_on(bridge.assert_ros_ok()); - async_std::task::block_on(bridge.assert_bridge_empy()); + bridge.assert_ros_ok().await; + bridge.assert_bridge_empy().await; thread::sleep(time::Duration::from_secs(1)); - async_std::task::block_on(bridge.assert_ros_ok()); - async_std::task::block_on(bridge.assert_bridge_empy()); + bridge.assert_ros_ok().await; + bridge.assert_bridge_empy().await; } -#[test] -fn env_checks_with_master_init_and_reconnect_many_times_to_master() { +#[tokio::test(flavor = "multi_thread")] +async fn env_checks_with_master_init_and_reconnect_many_times_to_master() { let roscfg = IsolatedROSMaster::default(); let mut ros_env = ROSEnvironment::new(roscfg.port.port); let bridge = RunningBridge::new(IsolatedConfig::default().peer(), roscfg.master_uri()); for _i in 0..20 { - async_std::task::block_on(bridge.assert_ros_error()); - async_std::task::block_on(bridge.assert_bridge_empy()); + bridge.assert_ros_error().await; + bridge.assert_bridge_empy().await; ros_env = ros_env.with_master(); - async_std::task::block_on(bridge.assert_ros_ok()); - async_std::task::block_on(bridge.assert_bridge_empy()); + bridge.assert_ros_ok().await; + bridge.assert_bridge_empy().await; ros_env = ros_env.without_master(); } } @@ -201,10 +191,10 @@ impl PingPong { .unwrap(); let zenoh_queryable = backend .make_zenoh_queryable(key, |q| { - async_std::task::spawn(async move { + tokio::spawn(async move { let key = q.key_expr().clone(); - let val = q.value().unwrap().clone(); - let _ = q.reply(Ok(Sample::new(key, val))).res_async().await; + let val = q.payload().unwrap().clone(); + let _ = q.reply(key, val).await; }); }) .await; @@ -237,7 +227,7 @@ impl PingPong { let zenoh_sub = backend .make_zenoh_subscriber(key, move |msg| { c.fetch_add(1, Relaxed); - let data = msg.value.payload.contiguous().to_vec(); + let data = msg.payload().into::>(); debug!( "PingPong: transferring {} bytes from Zenoh to ROS1!", data.len() @@ -275,7 +265,7 @@ impl PingPong { "PingPong: transferring {} bytes from ROS1 to Zenoh!", msg.0.len() ); - zpub.put(msg.0).res_sync().unwrap(); + zpub.put(msg.0).wait().unwrap(); }); PingPong { @@ -296,21 +286,19 @@ impl PingPong { async fn start_ping_pong(&self) -> bool { debug!("Starting ping-pong!"); - let mut data = Vec::new(); - data.reserve(TestParams::data_size() as usize); + let mut data = Vec::with_capacity(TestParams::data_size() as usize); for i in 0..TestParams::data_size() { data.push((i % 255) as u8); } - async { + tokio::time::timeout(Duration::from_secs(30), async { while { self.pub_sub.publisher.put(data.clone()); !wait_async_fn(|| self.cycles.load(Relaxed) > 0, Duration::from_secs(5)).await } { debug!("Restarting ping-pong!"); } - } - .timeout(Duration::from_secs(30)) + }) .await .is_ok() } @@ -333,7 +321,7 @@ impl PingPong { self.cycles.store(0, Relaxed); while !(result > 0.0 || duration >= 30000) { - async_std::task::sleep(Duration::from_millis(duration_milliseconds)).await; + tokio::time::sleep(Duration::from_millis(duration_milliseconds)).await; duration += duration_milliseconds; result += self.cycles.load(Relaxed) as f64; } @@ -360,7 +348,7 @@ struct TestEnvironment { _ros_env: ROSEnvironment, } impl TestEnvironment { - pub fn new() -> TestEnvironment { + pub async fn new() -> TestEnvironment { let cfg = IsolatedConfig::default(); let roscfg = IsolatedROSMaster::default(); @@ -376,9 +364,9 @@ impl TestEnvironment { // this will wait for the bridge to have some expected initial state and serves two purposes: // - asserts on the expected state // - performs wait and ensures that everything is properly connected and negotiated within the bridge - async_std::task::block_on(bridge.assert_ros_ok()); - async_std::task::block_on(bridge.assert_bridge_empy()); - async_std::task::block_on(checker.assert_zenoh_peers(1)); + bridge.assert_ros_ok().await; + bridge.assert_bridge_empy().await; + checker.assert_zenoh_peers(1).await; TestEnvironment { bridge, @@ -409,7 +397,7 @@ async fn ping_pong_duplex_parallel_many_( number: u32, mode: std::collections::HashSet, ) { - zenoh_core::zasync_executor_init!(); + zenoh::internal::zasync_executor_init!(); let make_keyexpr = |i: u32, mode: Mode| -> KeyExpr { format!( @@ -482,134 +470,110 @@ async fn ping_pong_duplex_parallel_many_( env.assert_bridge_status_synchronized().await; } -#[test] -fn ping_pong_zenoh_to_ros1() { - let env = TestEnvironment::new(); - futures::executor::block_on(ping_pong_duplex_parallel_many_( - &env, - 1, - HashSet::from([Mode::ZenohToRos1]), - )); +#[tokio::test(flavor = "multi_thread")] +async fn ping_pong_zenoh_to_ros1() { + let env = TestEnvironment::new().await; + ping_pong_duplex_parallel_many_(&env, 1, HashSet::from([Mode::ZenohToRos1])).await; } -#[test] -fn ping_pong_zenoh_to_ros1_many() { - let env = TestEnvironment::new(); - futures::executor::block_on(ping_pong_duplex_parallel_many_( +#[tokio::test(flavor = "multi_thread")] +async fn ping_pong_zenoh_to_ros1_many() { + let env = TestEnvironment::new().await; + ping_pong_duplex_parallel_many_( &env, TestParams::many_count(), HashSet::from([Mode::ZenohToRos1]), - )); + ) + .await; } -#[test] -fn ping_pong_ros1_to_zenoh() { - let env = TestEnvironment::new(); - futures::executor::block_on(ping_pong_duplex_parallel_many_( - &env, - 1, - HashSet::from([Mode::Ros1ToZenoh]), - )); +#[tokio::test(flavor = "multi_thread")] +async fn ping_pong_ros1_to_zenoh() { + let env = TestEnvironment::new().await; + ping_pong_duplex_parallel_many_(&env, 1, HashSet::from([Mode::Ros1ToZenoh])).await; } -#[test] -fn ping_pong_ros1_to_zenoh_many() { - let env = TestEnvironment::new(); - futures::executor::block_on(ping_pong_duplex_parallel_many_( +#[tokio::test(flavor = "multi_thread")] +async fn ping_pong_ros1_to_zenoh_many() { + let env = TestEnvironment::new().await; + ping_pong_duplex_parallel_many_( &env, TestParams::many_count(), HashSet::from([Mode::Ros1ToZenoh]), - )); + ) + .await; } -#[test] -fn ping_pong_ros1_service() { - let env = TestEnvironment::new(); - futures::executor::block_on(ping_pong_duplex_parallel_many_( - &env, - 1, - HashSet::from([Mode::Ros1Service]), - )); +#[tokio::test(flavor = "multi_thread")] +async fn ping_pong_ros1_service() { + let env = TestEnvironment::new().await; + ping_pong_duplex_parallel_many_(&env, 1, HashSet::from([Mode::Ros1Service])).await; } -#[test] -fn ping_pong_ros1_service_many() { - let env = TestEnvironment::new(); - futures::executor::block_on(ping_pong_duplex_parallel_many_( +#[tokio::test(flavor = "multi_thread")] +async fn ping_pong_ros1_service_many() { + let env = TestEnvironment::new().await; + ping_pong_duplex_parallel_many_( &env, TestParams::many_count(), HashSet::from([Mode::Ros1Service]), - )); + ) + .await; } -#[test] -fn ping_pong_ros1_client() { - let env = TestEnvironment::new(); - futures::executor::block_on(ping_pong_duplex_parallel_many_( - &env, - 1, - HashSet::from([Mode::Ros1Client]), - )); +#[tokio::test(flavor = "multi_thread")] +async fn ping_pong_ros1_client() { + let env = TestEnvironment::new().await; + ping_pong_duplex_parallel_many_(&env, 1, HashSet::from([Mode::Ros1Client])).await; } -#[test] -fn ping_pong_ros1_client_many() { - let env = TestEnvironment::new(); - futures::executor::block_on(ping_pong_duplex_parallel_many_( +#[tokio::test(flavor = "multi_thread")] +async fn ping_pong_ros1_client_many() { + let env = TestEnvironment::new().await; + ping_pong_duplex_parallel_many_( &env, TestParams::many_count(), HashSet::from([Mode::Ros1Client]), - )); + ) + .await; } -#[test] -fn ping_pong_all_sequential() { - let env = TestEnvironment::new(); - futures::executor::block_on(ping_pong_duplex_parallel_many_( - &env, - 1, - HashSet::from([Mode::ZenohToRos1]), - )); - futures::executor::block_on(ping_pong_duplex_parallel_many_( - &env, - 1, - HashSet::from([Mode::Ros1ToZenoh]), - )); - futures::executor::block_on(ping_pong_duplex_parallel_many_( - &env, - 1, - HashSet::from([Mode::Ros1Service]), - )); - futures::executor::block_on(ping_pong_duplex_parallel_many_( - &env, - 1, - HashSet::from([Mode::Ros1Client]), - )); +#[tokio::test(flavor = "multi_thread")] +async fn ping_pong_all_sequential() { + let env = TestEnvironment::new().await; + ping_pong_duplex_parallel_many_(&env, 1, HashSet::from([Mode::ZenohToRos1])).await; + ping_pong_duplex_parallel_many_(&env, 1, HashSet::from([Mode::Ros1ToZenoh])).await; + ping_pong_duplex_parallel_many_(&env, 1, HashSet::from([Mode::Ros1Service])).await; + ping_pong_duplex_parallel_many_(&env, 1, HashSet::from([Mode::Ros1Client])).await; } -#[test] -fn ping_pong_all_sequential_many() { - let env = TestEnvironment::new(); - futures::executor::block_on(ping_pong_duplex_parallel_many_( +#[tokio::test(flavor = "multi_thread")] +async fn ping_pong_all_sequential_many() { + let env = TestEnvironment::new().await; + ping_pong_duplex_parallel_many_( &env, TestParams::many_count(), HashSet::from([Mode::ZenohToRos1]), - )); - futures::executor::block_on(ping_pong_duplex_parallel_many_( + ) + .await; + ping_pong_duplex_parallel_many_( &env, TestParams::many_count(), HashSet::from([Mode::Ros1ToZenoh]), - )); - futures::executor::block_on(ping_pong_duplex_parallel_many_( + ) + .await; + ping_pong_duplex_parallel_many_( &env, TestParams::many_count(), HashSet::from([Mode::Ros1Service]), - )); - futures::executor::block_on(ping_pong_duplex_parallel_many_( + ) + .await; + ping_pong_duplex_parallel_many_( &env, TestParams::many_count(), HashSet::from([Mode::Ros1Client]), - )); + ) + .await; } -#[test] -fn ping_pong_all_parallel() { - let env = TestEnvironment::new(); +#[tokio::test(flavor = "multi_thread")] +async fn ping_pong_all_parallel() { + let env = TestEnvironment::new().await; futures::executor::block_on(ping_pong_duplex_parallel_many_( &env, 1, @@ -622,9 +586,9 @@ fn ping_pong_all_parallel() { )); } -#[test] -fn ping_pong_all_parallel_many() { - let env = TestEnvironment::new(); +#[tokio::test(flavor = "multi_thread")] +async fn ping_pong_all_parallel_many() { + let env = TestEnvironment::new().await; futures::executor::block_on(ping_pong_duplex_parallel_many_( &env, TestParams::many_count(), @@ -679,21 +643,21 @@ async fn parallel_subworks( } futures::future::join_all(subworks).await; } -#[test] -fn ping_pong_all_overlap_one() { - let env = TestEnvironment::new(); +#[tokio::test(flavor = "multi_thread")] +async fn ping_pong_all_overlap_one() { + let env = TestEnvironment::new().await; let main_work_finished = Arc::new(AtomicBool::new(false)); let main_work = main_work(&env, main_work_finished.clone()); let parallel_subworks = parallel_subworks(&env, main_work_finished, 1); - async_std::task::block_on(futures::future::join(main_work, parallel_subworks)); + futures::future::join(main_work, parallel_subworks).await; } -#[test] -fn ping_pong_all_overlap_many() { - let env = TestEnvironment::new(); +#[tokio::test(flavor = "multi_thread")] +async fn ping_pong_all_overlap_many() { + let env = TestEnvironment::new().await; let main_work_finished = Arc::new(AtomicBool::new(false)); let main_work = main_work(&env, main_work_finished.clone()); let parallel_subworks = parallel_subworks(&env, main_work_finished, 10); - async_std::task::block_on(futures::future::join(main_work, parallel_subworks)); + futures::future::join(main_work, parallel_subworks).await; } diff --git a/zenoh-plugin-ros1/tests/rosmaster_test.rs b/zenoh-plugin-ros1/tests/rosmaster_test.rs index 62b204a..e6196cc 100644 --- a/zenoh-plugin-ros1/tests/rosmaster_test.rs +++ b/zenoh-plugin-ros1/tests/rosmaster_test.rs @@ -17,27 +17,23 @@ use std::time::Duration; use serial_test::serial; use zenoh_plugin_ros1::ros_to_zenoh_bridge::ros1_master_ctrl::Ros1MasterCtrl; -#[test] +#[tokio::test(flavor = "multi_thread")] #[serial(ROS1)] -fn start_and_stop_master() { - async_std::task::block_on(async { - Ros1MasterCtrl::with_ros1_master() - .await - .expect("Error starting rosmaster"); +async fn start_and_stop_master() { + Ros1MasterCtrl::with_ros1_master() + .await + .expect("Error starting rosmaster"); - Ros1MasterCtrl::without_ros1_master().await; - }); + Ros1MasterCtrl::without_ros1_master().await; } -#[test] +#[tokio::test(flavor = "multi_thread")] #[serial(ROS1)] -fn start_and_stop_master_and_check_connectivity() { +async fn start_and_stop_master_and_check_connectivity() { // start rosmaster - async_std::task::block_on(async { - Ros1MasterCtrl::with_ros1_master() - .await - .expect("Error starting rosmaster"); - }); + Ros1MasterCtrl::with_ros1_master() + .await + .expect("Error starting rosmaster"); // start ros1 client let ros1_client = rosrust::api::Ros::new_raw( @@ -59,9 +55,7 @@ fn start_and_stop_master_and_check_connectivity() { } // stop rosmaster - async_std::task::block_on(async { - Ros1MasterCtrl::without_ros1_master().await; - }); + Ros1MasterCtrl::without_ros1_master().await; // check if there was a status from rosmaster... if !has_rosmaster {