From 6059b41ebdcb8403ed5c090e2b18b6f035598096 Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Thu, 15 Feb 2024 15:16:28 +0100 Subject: [PATCH 01/10] add support for QoS settings in sample --- Cargo.toml.in | 8 ++++---- src/commons.rs | 28 ++++++++++++++++++++++++++++ tests/z_int_pub_sub_test.c | 12 +++++++++++- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/Cargo.toml.in b/Cargo.toml.in index d1eec11bd..8f354ea52 100644 --- a/Cargo.toml.in +++ b/Cargo.toml.in @@ -49,10 +49,10 @@ log = "0.4.17" rand = "0.8.5" spin = "0.9.5" # shared-memory enabled for zenoh even if zenoh-c "shared-memory" feature is disabled. This is to make "std::mem::transmute" work for `ZSLice` -zenoh = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory", "unstable"], default-features = false } -zenoh-protocol = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory"] } -zenoh-util = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" } -zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["unstable"] } +zenoh = { version = "0.11.0-dev", git = "https://github.com/DenisBiryukov91/zenoh.git", branch = "feature/priority-in-sample", features = ["shared-memory", "unstable"], default-features = false } +zenoh-protocol = { version = "0.11.0-dev", git = "https://github.com/DenisBiryukov91/zenoh.git", branch = "feature/priority-in-sample", features = ["shared-memory"] } +zenoh-util = { version = "0.11.0-dev", git = "https://github.com/DenisBiryukov91/zenoh.git", branch = "feature/priority-in-sample" } +zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/DenisBiryukov91/zenoh.git", branch = "feature/priority-in-sample", features = ["unstable"] } [build-dependencies] cbindgen = "0.24.3" diff --git a/src/commons.rs b/src/commons.rs index 5d58663eb..cbb98ae97 100644 --- a/src/commons.rs +++ b/src/commons.rs @@ -14,7 +14,9 @@ use crate::collections::*; use crate::keyexpr::*; +use crate::z_congestion_control_t; use crate::z_id_t; +use crate::z_priority_t; use libc::c_void; use libc::{c_char, c_ulong}; use zenoh::buffers::ZBuf; @@ -22,6 +24,7 @@ use zenoh::prelude::SampleKind; use zenoh::prelude::SplitBuffer; use zenoh::query::ReplyKeyExpr; use zenoh::sample::Locality; +use zenoh::sample::QoS; use zenoh::sample::Sample; use zenoh_protocol::core::Timestamp; @@ -188,6 +191,29 @@ pub extern "C" fn zc_payload_null() -> zc_owned_payload_t { } } +/// QoS settings of zenoh message. +/// +/// Members: +/// z_priority_t priority: Priority of the message. +/// z_congestion_control_t congestion_control: Congestion control of the message. +/// bool express: If true, the message is not batched during transmission, in order to reduce latency +#[repr(C)] +pub struct z_qos_t { + pub priority: z_priority_t, + pub congestion_control: z_congestion_control_t, + pub express: bool, +} + +impl From for z_qos_t { + fn from(qos: QoS) -> Self { + z_qos_t { + priority: qos.priority.into(), + congestion_control: qos.congestion_control.into(), + express: qos.express.into() + } + } +} + /// A data sample. /// /// A sample is the value associated to a given resource at a given point in time. @@ -207,6 +233,7 @@ pub struct z_sample_t<'a> { pub _zc_buf: &'a c_void, pub kind: z_sample_kind_t, pub timestamp: z_timestamp_t, + pub qos: z_qos_t, pub attachment: z_attachment_t, } @@ -222,6 +249,7 @@ impl<'a> z_sample_t<'a> { _zc_buf: unsafe { std::mem::transmute(owner) }, kind: sample.kind.into(), timestamp: sample.timestamp.as_ref().into(), + qos: sample.qos.into(), attachment: match &sample.attachment { Some(attachment) => z_attachment_t { data: attachment as *const _ as *mut c_void, diff --git a/tests/z_int_pub_sub_test.c b/tests/z_int_pub_sub_test.c index 8a2825618..9ea0a29d2 100644 --- a/tests/z_int_pub_sub_test.c +++ b/tests/z_int_pub_sub_test.c @@ -37,7 +37,10 @@ int run_publisher() { return -1; } - z_owned_publisher_t pub = z_declare_publisher(z_loan(s), z_keyexpr(keyexpr), NULL); + z_publisher_options_t publisher_options = z_publisher_options_default(); + publisher_options.priority = Z_PRIORITY_DATA; + publisher_options.congestion_control = Z_CONGESTION_CONTROL_BLOCK; + z_owned_publisher_t pub = z_declare_publisher(z_loan(s), z_keyexpr(keyexpr), &publisher_options); if (!z_check(pub)) { perror("Unable to declare Publisher for key expression!"); return -1; @@ -68,6 +71,13 @@ void data_handler(const z_sample_t *sample, void *arg) { exit(-1); } + if (sample->qos.congestion_control != Z_CONGESTION_CONTROL_BLOCK + || sample->qos.priority != Z_PRIORITY_DATA + ) { + perror("Unexpected QoS values"); + exit(-1); + } + if (++val_num == values_count) { exit(0); }; From 969e59bfbf678816f235355baa92cd5d0d4e79f4 Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Thu, 15 Feb 2024 15:29:52 +0100 Subject: [PATCH 02/10] add cargo and .h files --- Cargo.lock | 50 ++++++++++++++++++++--------------------- Cargo.toml | 8 +++---- include/zenoh_commons.h | 14 ++++++++++++ 3 files changed, 43 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 593220380..6727b30c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2972,7 +2972,7 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "zenoh" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "async-global-executor", "async-std", @@ -3021,7 +3021,7 @@ dependencies = [ [[package]] name = "zenoh-buffers" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "zenoh-collections", ] @@ -3051,7 +3051,7 @@ dependencies = [ [[package]] name = "zenoh-codec" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "log", "serde", @@ -3064,12 +3064,12 @@ dependencies = [ [[package]] name = "zenoh-collections" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" [[package]] name = "zenoh-config" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "flume", "json5", @@ -3088,7 +3088,7 @@ dependencies = [ [[package]] name = "zenoh-core" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "async-std", "lazy_static", @@ -3098,7 +3098,7 @@ dependencies = [ [[package]] name = "zenoh-crypto" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "aes", "hmac", @@ -3111,7 +3111,7 @@ dependencies = [ [[package]] name = "zenoh-ext" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "async-std", "bincode", @@ -3131,7 +3131,7 @@ dependencies = [ [[package]] name = "zenoh-keyexpr" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "hashbrown 0.14.0", "keyed-set", @@ -3145,7 +3145,7 @@ dependencies = [ [[package]] name = "zenoh-link" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "async-std", "async-trait", @@ -3164,7 +3164,7 @@ dependencies = [ [[package]] name = "zenoh-link-commons" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "async-std", "async-trait", @@ -3181,7 +3181,7 @@ dependencies = [ [[package]] name = "zenoh-link-quic" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "async-rustls", "async-std", @@ -3207,7 +3207,7 @@ dependencies = [ [[package]] name = "zenoh-link-tcp" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "async-std", "async-trait", @@ -3223,7 +3223,7 @@ dependencies = [ [[package]] name = "zenoh-link-tls" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "async-rustls", "async-std", @@ -3248,7 +3248,7 @@ dependencies = [ [[package]] name = "zenoh-link-udp" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "async-std", "async-trait", @@ -3267,7 +3267,7 @@ dependencies = [ [[package]] name = "zenoh-link-unixsock_stream" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "async-std", "async-trait", @@ -3285,7 +3285,7 @@ dependencies = [ [[package]] name = "zenoh-link-ws" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "async-std", "async-trait", @@ -3305,7 +3305,7 @@ dependencies = [ [[package]] name = "zenoh-macros" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "proc-macro2", "quote", @@ -3318,7 +3318,7 @@ dependencies = [ [[package]] name = "zenoh-plugin-trait" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "const_format", "libloading", @@ -3334,7 +3334,7 @@ dependencies = [ [[package]] name = "zenoh-protocol" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "const_format", "hex", @@ -3350,7 +3350,7 @@ dependencies = [ [[package]] name = "zenoh-result" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "anyhow", ] @@ -3358,7 +3358,7 @@ dependencies = [ [[package]] name = "zenoh-shm" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "bincode", "log", @@ -3371,7 +3371,7 @@ dependencies = [ [[package]] name = "zenoh-sync" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "async-std", "event-listener 4.0.0", @@ -3386,7 +3386,7 @@ dependencies = [ [[package]] name = "zenoh-transport" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "async-executor", "async-global-executor", @@ -3418,7 +3418,7 @@ dependencies = [ [[package]] name = "zenoh-util" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" dependencies = [ "async-std", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 52deaa71c..a85b36e24 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,10 +49,10 @@ log = "0.4.17" rand = "0.8.5" spin = "0.9.5" # shared-memory enabled for zenoh even if zenoh-c "shared-memory" feature is disabled. This is to make "std::mem::transmute" work for `ZSLice` -zenoh = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory", "unstable"], default-features = false } -zenoh-protocol = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory"] } -zenoh-util = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" } -zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["unstable"] } +zenoh = { version = "0.11.0-dev", git = "https://github.com/DenisBiryukov91/zenoh.git", branch = "feature/priority-in-sample", features = ["shared-memory", "unstable"], default-features = false } +zenoh-protocol = { version = "0.11.0-dev", git = "https://github.com/DenisBiryukov91/zenoh.git", branch = "feature/priority-in-sample", features = ["shared-memory"] } +zenoh-util = { version = "0.11.0-dev", git = "https://github.com/DenisBiryukov91/zenoh.git", branch = "feature/priority-in-sample" } +zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/DenisBiryukov91/zenoh.git", branch = "feature/priority-in-sample", features = ["unstable"] } [build-dependencies] cbindgen = "0.24.3" diff --git a/include/zenoh_commons.h b/include/zenoh_commons.h index 58e7a2856..4cef77548 100644 --- a/include/zenoh_commons.h +++ b/include/zenoh_commons.h @@ -398,6 +398,19 @@ typedef struct z_timestamp_t { uint64_t time; struct z_id_t id; } z_timestamp_t; +/** + * QoS settings of zenoh message. + * + * Members: + * z_priority_t priority: Priority of the message. + * z_congestion_control_t congestion_control: Congestion control of the message. + * bool express: If true, the message is not batched during transmission, in order to reduce latency + */ +typedef struct z_qos_t { + enum z_priority_t priority; + enum z_congestion_control_t congestion_control; + bool express; +} z_qos_t; /** * A data sample. * @@ -418,6 +431,7 @@ typedef struct z_sample_t { const void *_zc_buf; enum z_sample_kind_t kind; struct z_timestamp_t timestamp; + struct z_qos_t qos; struct z_attachment_t attachment; } z_sample_t; /** From 6bc51e2bbe7da69ffd448103f49f4826617103c5 Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Thu, 15 Feb 2024 19:37:08 +0100 Subject: [PATCH 03/10] add dots at the end of docstrings --- include/zenoh_commons.h | 2 +- src/commons.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/zenoh_commons.h b/include/zenoh_commons.h index 4cef77548..60878fdb2 100644 --- a/include/zenoh_commons.h +++ b/include/zenoh_commons.h @@ -404,7 +404,7 @@ typedef struct z_timestamp_t { * Members: * z_priority_t priority: Priority of the message. * z_congestion_control_t congestion_control: Congestion control of the message. - * bool express: If true, the message is not batched during transmission, in order to reduce latency + * bool express: If true, the message is not batched during transmission, in order to reduce latency. */ typedef struct z_qos_t { enum z_priority_t priority; diff --git a/src/commons.rs b/src/commons.rs index cbb98ae97..f3e3bc710 100644 --- a/src/commons.rs +++ b/src/commons.rs @@ -196,7 +196,7 @@ pub extern "C" fn zc_payload_null() -> zc_owned_payload_t { /// Members: /// z_priority_t priority: Priority of the message. /// z_congestion_control_t congestion_control: Congestion control of the message. -/// bool express: If true, the message is not batched during transmission, in order to reduce latency +/// bool express: If true, the message is not batched during transmission, in order to reduce latency. #[repr(C)] pub struct z_qos_t { pub priority: z_priority_t, From 50019f3f5ffe6f4fcaf2b8257b3db5153fde6e30 Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Fri, 16 Feb 2024 10:16:43 +0100 Subject: [PATCH 04/10] fix clippy --- src/commons.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commons.rs b/src/commons.rs index f3e3bc710..e2e0a9036 100644 --- a/src/commons.rs +++ b/src/commons.rs @@ -209,7 +209,7 @@ impl From for z_qos_t { z_qos_t { priority: qos.priority.into(), congestion_control: qos.congestion_control.into(), - express: qos.express.into() + express: qos.express, } } } From 2cadb900b78ae75157dede10a16f24fa921cd0cd Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Tue, 20 Feb 2024 15:58:15 +0100 Subject: [PATCH 05/10] reduce qos size to 1 byte; use getters to extract individual qos settings --- include/zenoh_commons.h | 24 +++++++++++++------ src/commons.rs | 49 ++++++++++++++++++++++++++------------ tests/z_int_pub_sub_test.c | 4 ++-- 3 files changed, 53 insertions(+), 24 deletions(-) diff --git a/include/zenoh_commons.h b/include/zenoh_commons.h index 60878fdb2..a93304fd6 100644 --- a/include/zenoh_commons.h +++ b/include/zenoh_commons.h @@ -401,15 +401,9 @@ typedef struct z_timestamp_t { /** * QoS settings of zenoh message. * - * Members: - * z_priority_t priority: Priority of the message. - * z_congestion_control_t congestion_control: Congestion control of the message. - * bool express: If true, the message is not batched during transmission, in order to reduce latency. */ typedef struct z_qos_t { - enum z_priority_t priority; - enum z_congestion_control_t congestion_control; - bool express; + uint8_t _0; } z_qos_t; /** * A data sample. @@ -1725,6 +1719,22 @@ int8_t z_put(struct z_session_t session, * Constructs the default value for :c:type:`z_put_options_t`. */ ZENOHC_API struct z_put_options_t z_put_options_default(void); +/** + * Returns default qos settings. + */ +ZENOHC_API struct z_qos_t z_qos_default(void); +/** + * Returns message congestion control. + */ +ZENOHC_API enum z_congestion_control_t z_qos_get_congestion_control(struct z_qos_t qos); +/** + * Returns message express flag. If set to true, the message is not batched to reduce the latency. + */ +ZENOHC_API bool z_qos_get_express(struct z_qos_t qos); +/** + * Returns message priority. + */ +ZENOHC_API enum z_priority_t z_qos_get_priority(struct z_qos_t qos); /** * Returns the attachment to the query by aliasing. * diff --git a/src/commons.rs b/src/commons.rs index e2e0a9036..8ac21cb11 100644 --- a/src/commons.rs +++ b/src/commons.rs @@ -17,6 +17,7 @@ use crate::keyexpr::*; use crate::z_congestion_control_t; use crate::z_id_t; use crate::z_priority_t; +use crate::{impl_guarded_transmute, GuardedTransmute}; use libc::c_void; use libc::{c_char, c_ulong}; use zenoh::buffers::ZBuf; @@ -192,28 +193,46 @@ pub extern "C" fn zc_payload_null() -> zc_owned_payload_t { } /// QoS settings of zenoh message. -/// -/// Members: -/// z_priority_t priority: Priority of the message. -/// z_congestion_control_t congestion_control: Congestion control of the message. -/// bool express: If true, the message is not batched during transmission, in order to reduce latency. +/// #[repr(C)] -pub struct z_qos_t { - pub priority: z_priority_t, - pub congestion_control: z_congestion_control_t, - pub express: bool, -} +pub struct z_qos_t(u8); + +impl_guarded_transmute!(QoS, z_qos_t); +impl_guarded_transmute!(z_qos_t, QoS); impl From for z_qos_t { fn from(qos: QoS) -> Self { - z_qos_t { - priority: qos.priority.into(), - congestion_control: qos.congestion_control.into(), - express: qos.express, - } + qos.transmute() } } +impl From for QoS { + fn from(qos: z_qos_t) -> QoS { + qos.transmute() + } +} + +/// Returns message priority. +#[no_mangle] +pub extern "C" fn z_qos_get_priority(qos: z_qos_t) -> z_priority_t { + qos.transmute().priority().into() +} +/// Returns message congestion control. +#[no_mangle] +pub extern "C" fn z_qos_get_congestion_control(qos: z_qos_t) -> z_congestion_control_t { + qos.transmute().congestion_control().into() +} +/// Returns message express flag. If set to true, the message is not batched to reduce the latency. +#[no_mangle] +pub extern "C" fn z_qos_get_express(qos: z_qos_t) -> bool { + qos.transmute().express() +} +/// Returns default qos settings. +#[no_mangle] +pub extern "C" fn z_qos_default() -> z_qos_t { + QoS::default().transmute() +} + /// A data sample. /// /// A sample is the value associated to a given resource at a given point in time. diff --git a/tests/z_int_pub_sub_test.c b/tests/z_int_pub_sub_test.c index 9ea0a29d2..cf005a80f 100644 --- a/tests/z_int_pub_sub_test.c +++ b/tests/z_int_pub_sub_test.c @@ -71,8 +71,8 @@ void data_handler(const z_sample_t *sample, void *arg) { exit(-1); } - if (sample->qos.congestion_control != Z_CONGESTION_CONTROL_BLOCK - || sample->qos.priority != Z_PRIORITY_DATA + if (z_qos_get_congestion_control(sample->qos) != Z_CONGESTION_CONTROL_BLOCK + || z_qos_get_priority(sample->qos) != Z_PRIORITY_DATA ) { perror("Unexpected QoS values"); exit(-1); From d787d031b2bcb32e14ccd36c5fb28b71ebe88e28 Mon Sep 17 00:00:00 2001 From: eclipse-zenoh-bot Date: Fri, 23 Feb 2024 00:11:08 +0000 Subject: [PATCH 06/10] chore: Sync Cargo lockfile with Zenoh's --- Cargo.lock | 55 +++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 593220380..dc868f36e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2342,9 +2342,9 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" +checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" [[package]] name = "thiserror" @@ -2972,7 +2972,7 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "zenoh" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "async-global-executor", "async-std", @@ -3007,6 +3007,7 @@ dependencies = [ "zenoh-config", "zenoh-core", "zenoh-crypto", + "zenoh-keyexpr", "zenoh-link", "zenoh-macros", "zenoh-plugin-trait", @@ -3021,7 +3022,7 @@ dependencies = [ [[package]] name = "zenoh-buffers" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "zenoh-collections", ] @@ -3051,7 +3052,7 @@ dependencies = [ [[package]] name = "zenoh-codec" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "log", "serde", @@ -3064,12 +3065,12 @@ dependencies = [ [[package]] name = "zenoh-collections" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" [[package]] name = "zenoh-config" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "flume", "json5", @@ -3088,7 +3089,7 @@ dependencies = [ [[package]] name = "zenoh-core" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "async-std", "lazy_static", @@ -3098,7 +3099,7 @@ dependencies = [ [[package]] name = "zenoh-crypto" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "aes", "hmac", @@ -3111,7 +3112,7 @@ dependencies = [ [[package]] name = "zenoh-ext" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "async-std", "bincode", @@ -3131,7 +3132,7 @@ dependencies = [ [[package]] name = "zenoh-keyexpr" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "hashbrown 0.14.0", "keyed-set", @@ -3145,7 +3146,7 @@ dependencies = [ [[package]] name = "zenoh-link" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "async-std", "async-trait", @@ -3164,7 +3165,7 @@ dependencies = [ [[package]] name = "zenoh-link-commons" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "async-std", "async-trait", @@ -3181,7 +3182,7 @@ dependencies = [ [[package]] name = "zenoh-link-quic" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "async-rustls", "async-std", @@ -3207,7 +3208,7 @@ dependencies = [ [[package]] name = "zenoh-link-tcp" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "async-std", "async-trait", @@ -3223,7 +3224,7 @@ dependencies = [ [[package]] name = "zenoh-link-tls" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "async-rustls", "async-std", @@ -3248,7 +3249,7 @@ dependencies = [ [[package]] name = "zenoh-link-udp" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "async-std", "async-trait", @@ -3267,7 +3268,7 @@ dependencies = [ [[package]] name = "zenoh-link-unixsock_stream" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "async-std", "async-trait", @@ -3285,7 +3286,7 @@ dependencies = [ [[package]] name = "zenoh-link-ws" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "async-std", "async-trait", @@ -3305,7 +3306,7 @@ dependencies = [ [[package]] name = "zenoh-macros" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "proc-macro2", "quote", @@ -3318,7 +3319,7 @@ dependencies = [ [[package]] name = "zenoh-plugin-trait" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "const_format", "libloading", @@ -3334,7 +3335,7 @@ dependencies = [ [[package]] name = "zenoh-protocol" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "const_format", "hex", @@ -3350,7 +3351,7 @@ dependencies = [ [[package]] name = "zenoh-result" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "anyhow", ] @@ -3358,7 +3359,7 @@ dependencies = [ [[package]] name = "zenoh-shm" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "bincode", "log", @@ -3371,7 +3372,7 @@ dependencies = [ [[package]] name = "zenoh-sync" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "async-std", "event-listener 4.0.0", @@ -3386,7 +3387,7 @@ dependencies = [ [[package]] name = "zenoh-transport" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "async-executor", "async-global-executor", @@ -3418,7 +3419,7 @@ dependencies = [ [[package]] name = "zenoh-util" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" dependencies = [ "async-std", "async-trait", From 7a056427c693d4fba71583d1cbe910d5ec1dafc4 Mon Sep 17 00:00:00 2001 From: eclipse-zenoh-bot Date: Fri, 23 Feb 2024 13:02:29 +0000 Subject: [PATCH 07/10] chore: Sync Cargo lockfile with Zenoh's --- Cargo.lock | 54 +++++++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dc868f36e..6db5ea130 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2972,7 +2972,7 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "zenoh" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-global-executor", "async-std", @@ -3022,7 +3022,7 @@ dependencies = [ [[package]] name = "zenoh-buffers" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "zenoh-collections", ] @@ -3052,7 +3052,7 @@ dependencies = [ [[package]] name = "zenoh-codec" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "log", "serde", @@ -3065,12 +3065,12 @@ dependencies = [ [[package]] name = "zenoh-collections" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" [[package]] name = "zenoh-config" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "flume", "json5", @@ -3089,7 +3089,7 @@ dependencies = [ [[package]] name = "zenoh-core" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "lazy_static", @@ -3099,7 +3099,7 @@ dependencies = [ [[package]] name = "zenoh-crypto" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "aes", "hmac", @@ -3112,7 +3112,7 @@ dependencies = [ [[package]] name = "zenoh-ext" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "bincode", @@ -3132,7 +3132,7 @@ dependencies = [ [[package]] name = "zenoh-keyexpr" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "hashbrown 0.14.0", "keyed-set", @@ -3146,7 +3146,7 @@ dependencies = [ [[package]] name = "zenoh-link" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "async-trait", @@ -3165,24 +3165,28 @@ dependencies = [ [[package]] name = "zenoh-link-commons" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "async-trait", "flume", + "log", "lz4_flex", "serde", "typenum", "zenoh-buffers", "zenoh-codec", + "zenoh-core", "zenoh-protocol", "zenoh-result", + "zenoh-sync", + "zenoh-util", ] [[package]] name = "zenoh-link-quic" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-rustls", "async-std", @@ -3208,7 +3212,7 @@ dependencies = [ [[package]] name = "zenoh-link-tcp" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "async-trait", @@ -3224,7 +3228,7 @@ dependencies = [ [[package]] name = "zenoh-link-tls" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-rustls", "async-std", @@ -3249,7 +3253,7 @@ dependencies = [ [[package]] name = "zenoh-link-udp" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "async-trait", @@ -3268,7 +3272,7 @@ dependencies = [ [[package]] name = "zenoh-link-unixsock_stream" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "async-trait", @@ -3286,7 +3290,7 @@ dependencies = [ [[package]] name = "zenoh-link-ws" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "async-trait", @@ -3306,7 +3310,7 @@ dependencies = [ [[package]] name = "zenoh-macros" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "proc-macro2", "quote", @@ -3319,7 +3323,7 @@ dependencies = [ [[package]] name = "zenoh-plugin-trait" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "const_format", "libloading", @@ -3335,7 +3339,7 @@ dependencies = [ [[package]] name = "zenoh-protocol" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "const_format", "hex", @@ -3351,7 +3355,7 @@ dependencies = [ [[package]] name = "zenoh-result" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "anyhow", ] @@ -3359,7 +3363,7 @@ dependencies = [ [[package]] name = "zenoh-shm" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "bincode", "log", @@ -3372,7 +3376,7 @@ dependencies = [ [[package]] name = "zenoh-sync" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "event-listener 4.0.0", @@ -3387,7 +3391,7 @@ dependencies = [ [[package]] name = "zenoh-transport" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-executor", "async-global-executor", @@ -3419,7 +3423,7 @@ dependencies = [ [[package]] name = "zenoh-util" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7ebdb3cab481609989f1e9d3124e75d2851458e5" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "async-trait", From e53d5ccfe3c2917023a5ddc2d93cb8a627edae59 Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Fri, 23 Feb 2024 14:15:23 +0100 Subject: [PATCH 08/10] fix zenoh branch to main --- Cargo.lock | 55 ++++++++++++++++++++++++++++----------------------- Cargo.toml | 8 ++++---- Cargo.toml.in | 8 ++++---- 3 files changed, 38 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6727b30c6..4d2dbdebc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2972,7 +2972,7 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "zenoh" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-global-executor", "async-std", @@ -3007,6 +3007,7 @@ dependencies = [ "zenoh-config", "zenoh-core", "zenoh-crypto", + "zenoh-keyexpr", "zenoh-link", "zenoh-macros", "zenoh-plugin-trait", @@ -3021,7 +3022,7 @@ dependencies = [ [[package]] name = "zenoh-buffers" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "zenoh-collections", ] @@ -3051,7 +3052,7 @@ dependencies = [ [[package]] name = "zenoh-codec" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "log", "serde", @@ -3064,12 +3065,12 @@ dependencies = [ [[package]] name = "zenoh-collections" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" [[package]] name = "zenoh-config" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "flume", "json5", @@ -3088,7 +3089,7 @@ dependencies = [ [[package]] name = "zenoh-core" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "lazy_static", @@ -3098,7 +3099,7 @@ dependencies = [ [[package]] name = "zenoh-crypto" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "aes", "hmac", @@ -3111,7 +3112,7 @@ dependencies = [ [[package]] name = "zenoh-ext" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "bincode", @@ -3131,7 +3132,7 @@ dependencies = [ [[package]] name = "zenoh-keyexpr" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "hashbrown 0.14.0", "keyed-set", @@ -3145,7 +3146,7 @@ dependencies = [ [[package]] name = "zenoh-link" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "async-trait", @@ -3164,24 +3165,28 @@ dependencies = [ [[package]] name = "zenoh-link-commons" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "async-trait", "flume", + "log", "lz4_flex", "serde", "typenum", "zenoh-buffers", "zenoh-codec", + "zenoh-core", "zenoh-protocol", "zenoh-result", + "zenoh-sync", + "zenoh-util", ] [[package]] name = "zenoh-link-quic" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-rustls", "async-std", @@ -3207,7 +3212,7 @@ dependencies = [ [[package]] name = "zenoh-link-tcp" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "async-trait", @@ -3223,7 +3228,7 @@ dependencies = [ [[package]] name = "zenoh-link-tls" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-rustls", "async-std", @@ -3248,7 +3253,7 @@ dependencies = [ [[package]] name = "zenoh-link-udp" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "async-trait", @@ -3267,7 +3272,7 @@ dependencies = [ [[package]] name = "zenoh-link-unixsock_stream" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "async-trait", @@ -3285,7 +3290,7 @@ dependencies = [ [[package]] name = "zenoh-link-ws" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "async-trait", @@ -3305,7 +3310,7 @@ dependencies = [ [[package]] name = "zenoh-macros" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "proc-macro2", "quote", @@ -3318,7 +3323,7 @@ dependencies = [ [[package]] name = "zenoh-plugin-trait" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "const_format", "libloading", @@ -3334,7 +3339,7 @@ dependencies = [ [[package]] name = "zenoh-protocol" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "const_format", "hex", @@ -3350,7 +3355,7 @@ dependencies = [ [[package]] name = "zenoh-result" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "anyhow", ] @@ -3358,7 +3363,7 @@ dependencies = [ [[package]] name = "zenoh-shm" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "bincode", "log", @@ -3371,7 +3376,7 @@ dependencies = [ [[package]] name = "zenoh-sync" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "event-listener 4.0.0", @@ -3386,7 +3391,7 @@ dependencies = [ [[package]] name = "zenoh-transport" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-executor", "async-global-executor", @@ -3418,7 +3423,7 @@ dependencies = [ [[package]] name = "zenoh-util" version = "0.11.0-dev" -source = "git+https://github.com/DenisBiryukov91/zenoh.git?branch=feature/priority-in-sample#2f21cfbf7a608915abedea8974953abfe92a47a9" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" dependencies = [ "async-std", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index a85b36e24..52deaa71c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,10 +49,10 @@ log = "0.4.17" rand = "0.8.5" spin = "0.9.5" # shared-memory enabled for zenoh even if zenoh-c "shared-memory" feature is disabled. This is to make "std::mem::transmute" work for `ZSLice` -zenoh = { version = "0.11.0-dev", git = "https://github.com/DenisBiryukov91/zenoh.git", branch = "feature/priority-in-sample", features = ["shared-memory", "unstable"], default-features = false } -zenoh-protocol = { version = "0.11.0-dev", git = "https://github.com/DenisBiryukov91/zenoh.git", branch = "feature/priority-in-sample", features = ["shared-memory"] } -zenoh-util = { version = "0.11.0-dev", git = "https://github.com/DenisBiryukov91/zenoh.git", branch = "feature/priority-in-sample" } -zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/DenisBiryukov91/zenoh.git", branch = "feature/priority-in-sample", features = ["unstable"] } +zenoh = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory", "unstable"], default-features = false } +zenoh-protocol = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory"] } +zenoh-util = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" } +zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["unstable"] } [build-dependencies] cbindgen = "0.24.3" diff --git a/Cargo.toml.in b/Cargo.toml.in index 8f354ea52..d1eec11bd 100644 --- a/Cargo.toml.in +++ b/Cargo.toml.in @@ -49,10 +49,10 @@ log = "0.4.17" rand = "0.8.5" spin = "0.9.5" # shared-memory enabled for zenoh even if zenoh-c "shared-memory" feature is disabled. This is to make "std::mem::transmute" work for `ZSLice` -zenoh = { version = "0.11.0-dev", git = "https://github.com/DenisBiryukov91/zenoh.git", branch = "feature/priority-in-sample", features = ["shared-memory", "unstable"], default-features = false } -zenoh-protocol = { version = "0.11.0-dev", git = "https://github.com/DenisBiryukov91/zenoh.git", branch = "feature/priority-in-sample", features = ["shared-memory"] } -zenoh-util = { version = "0.11.0-dev", git = "https://github.com/DenisBiryukov91/zenoh.git", branch = "feature/priority-in-sample" } -zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/DenisBiryukov91/zenoh.git", branch = "feature/priority-in-sample", features = ["unstable"] } +zenoh = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory", "unstable"], default-features = false } +zenoh-protocol = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory"] } +zenoh-util = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" } +zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["unstable"] } [build-dependencies] cbindgen = "0.24.3" From fc16c4bf29e84aa4f37facd08464bd3334e081b4 Mon Sep 17 00:00:00 2001 From: eclipse-zenoh-bot Date: Tue, 27 Feb 2024 00:11:49 +0000 Subject: [PATCH 09/10] chore: Sync Cargo lockfile with Zenoh's --- Cargo.lock | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6db5ea130..6d2575fae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2972,7 +2972,7 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "zenoh" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "async-global-executor", "async-std", @@ -3022,7 +3022,7 @@ dependencies = [ [[package]] name = "zenoh-buffers" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "zenoh-collections", ] @@ -3052,7 +3052,7 @@ dependencies = [ [[package]] name = "zenoh-codec" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "log", "serde", @@ -3065,12 +3065,12 @@ dependencies = [ [[package]] name = "zenoh-collections" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" [[package]] name = "zenoh-config" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "flume", "json5", @@ -3089,7 +3089,7 @@ dependencies = [ [[package]] name = "zenoh-core" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "async-std", "lazy_static", @@ -3099,7 +3099,7 @@ dependencies = [ [[package]] name = "zenoh-crypto" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "aes", "hmac", @@ -3112,7 +3112,7 @@ dependencies = [ [[package]] name = "zenoh-ext" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "async-std", "bincode", @@ -3132,7 +3132,7 @@ dependencies = [ [[package]] name = "zenoh-keyexpr" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "hashbrown 0.14.0", "keyed-set", @@ -3146,7 +3146,7 @@ dependencies = [ [[package]] name = "zenoh-link" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "async-std", "async-trait", @@ -3165,7 +3165,7 @@ dependencies = [ [[package]] name = "zenoh-link-commons" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "async-std", "async-trait", @@ -3186,7 +3186,7 @@ dependencies = [ [[package]] name = "zenoh-link-quic" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "async-rustls", "async-std", @@ -3212,7 +3212,7 @@ dependencies = [ [[package]] name = "zenoh-link-tcp" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "async-std", "async-trait", @@ -3228,7 +3228,7 @@ dependencies = [ [[package]] name = "zenoh-link-tls" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "async-rustls", "async-std", @@ -3253,7 +3253,7 @@ dependencies = [ [[package]] name = "zenoh-link-udp" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "async-std", "async-trait", @@ -3272,7 +3272,7 @@ dependencies = [ [[package]] name = "zenoh-link-unixsock_stream" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "async-std", "async-trait", @@ -3290,7 +3290,7 @@ dependencies = [ [[package]] name = "zenoh-link-ws" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "async-std", "async-trait", @@ -3310,7 +3310,7 @@ dependencies = [ [[package]] name = "zenoh-macros" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "proc-macro2", "quote", @@ -3323,7 +3323,7 @@ dependencies = [ [[package]] name = "zenoh-plugin-trait" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "const_format", "libloading", @@ -3339,7 +3339,7 @@ dependencies = [ [[package]] name = "zenoh-protocol" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "const_format", "hex", @@ -3355,7 +3355,7 @@ dependencies = [ [[package]] name = "zenoh-result" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "anyhow", ] @@ -3363,7 +3363,7 @@ dependencies = [ [[package]] name = "zenoh-shm" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "bincode", "log", @@ -3376,7 +3376,7 @@ dependencies = [ [[package]] name = "zenoh-sync" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "async-std", "event-listener 4.0.0", @@ -3391,7 +3391,7 @@ dependencies = [ [[package]] name = "zenoh-transport" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "async-executor", "async-global-executor", @@ -3423,7 +3423,7 @@ dependencies = [ [[package]] name = "zenoh-util" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#42f9384c93658b6d0001667ad9784aead285e553" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#7d9d684cf953f9f813eb320812eaf95f767ef200" dependencies = [ "async-std", "async-trait", From bf8d4f9e354fedcf0b13608c11afa0c5c717d1a8 Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Wed, 28 Feb 2024 10:54:18 +0100 Subject: [PATCH 10/10] add memory-related API --- docs/examples.rst | 8 ++++---- examples/z_ping.c | 8 ++++---- examples/z_pub_thr.c | 2 +- examples/z_scout.c | 4 ++-- examples/z_sub_thr.c | 4 ++-- include/zenoh.h | 1 + include/zenoh_memory.h | 7 +++++++ tests/z_api_alignment_test.c | 4 ++-- 8 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 include/zenoh_memory.h diff --git a/docs/examples.rst b/docs/examples.rst index 045187253..bea19cbbe 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -44,10 +44,10 @@ Subscribe #include "zenoh.h" void data_handler(const z_sample_t *sample, const void *arg) { - char *keystr = z_keyexpr_to_string(sample->keyexpr); + z_owned_str_t keystr = z_keyexpr_to_string(sample->keyexpr); printf(">> Received (%s, %.*s)\n", keystr, (int)sample->payload.len, sample->payload.start); - free(keystr); + z_drop(z_move(keystr)); } int main(int argc, char **argv) { @@ -87,9 +87,9 @@ Query if (z_reply_is_ok(&reply)) { z_sample_t sample = z_reply_ok(&reply); - char *keystr = z_keyexpr_to_string(sample.keyexpr); + z_owned_str_t keystr = z_keyexpr_to_string(sample.keyexpr); printf(">> Received ('%s': '%.*s')\n", keystr, (int)sample.payload.len, sample.payload.start); - free(keystr); + z_drop(z_move(keystr)); } } diff --git a/examples/z_ping.c b/examples/z_ping.c index 535f1d079..45393aaec 100644 --- a/examples/z_ping.c +++ b/examples/z_ping.c @@ -52,7 +52,7 @@ int main(int argc, char** argv) { z_owned_publisher_t pub = z_declare_publisher(z_loan(session), ping, NULL); z_owned_closure_sample_t respond = z_closure(callback, drop, (void*)(&pub)); z_owned_subscriber_t sub = z_declare_subscriber(z_loan(session), pong, z_move(respond), NULL); - uint8_t* data = malloc(args.size); + uint8_t* data = z_malloc(args.size); for (int i = 0; i < args.size; i++) { data[i] = i % 10; } @@ -76,7 +76,7 @@ int main(int argc, char** argv) { } } struct timespec t_start, t_stop, t_timeout; - unsigned long* results = malloc(sizeof(unsigned long) * args.number_of_pings); + unsigned long* results = z_malloc(sizeof(unsigned long) * args.number_of_pings); for (int i = 0; i < args.number_of_pings; i++) { clock_gettime(CLOCK_REALTIME, &t_timeout); t_timeout.tv_sec += PING_TIMEOUT_SEC; @@ -93,8 +93,8 @@ int main(int argc, char** argv) { printf("%d bytes: seq=%d rtt=%luµs, lat=%luµs\n", args.size, i, results[i], results[i] / 2); } pthread_mutex_unlock(&mutex); - free(results); - free(data); + z_free(results); + z_free(data); z_drop(z_move(sub)); z_drop(z_move(pub)); z_close(z_move(session)); diff --git a/examples/z_pub_thr.c b/examples/z_pub_thr.c index eb72432a0..8686c33eb 100644 --- a/examples/z_pub_thr.c +++ b/examples/z_pub_thr.c @@ -24,7 +24,7 @@ int main(int argc, char **argv) { char *keyexpr = "test/thr"; size_t len = atoi(argv[1]); - uint8_t *value = (uint8_t *)malloc(len); + uint8_t *value = (uint8_t *)z_malloc(len); memset(value, 1, len); z_owned_config_t config = z_config_default(); diff --git a/examples/z_scout.c b/examples/z_scout.c index ca5e8944b..3b882f547 100644 --- a/examples/z_scout.c +++ b/examples/z_scout.c @@ -83,14 +83,14 @@ void callback(z_owned_hello_t *hello, void *context) { void drop(void *context) { printf("Dropping scout\n"); int count = *(int *)context; - free(context); + z_free(context); if (!count) { printf("Did not find any zenoh process.\n"); } } int main(int argc, char **argv) { - int *context = malloc(sizeof(int)); + int *context = z_malloc(sizeof(int)); *context = 0; z_owned_scouting_config_t config = z_scouting_config_default(); z_owned_closure_hello_t closure = z_closure(callback, drop, context); diff --git a/examples/z_sub_thr.c b/examples/z_sub_thr.c index d82b6ea81..d32480174 100644 --- a/examples/z_sub_thr.c +++ b/examples/z_sub_thr.c @@ -26,7 +26,7 @@ typedef struct { } z_stats_t; z_stats_t *z_stats_make() { - z_stats_t *stats = malloc(sizeof(z_stats_t)); + z_stats_t *stats = z_malloc(sizeof(z_stats_t)); stats->count = 0; stats->finished_rounds = 0; stats->first_start.tv_nsec = 0; @@ -63,7 +63,7 @@ void drop_stats(void *context) { double elapsed_s = get_elapsed_s(&stats->first_start, &end); printf("Stats being dropped after unsubscribing: sent %ld messages over %f seconds (%f msg/s)\n", sent_messages, elapsed_s, (double)sent_messages / elapsed_s); - free(context); + z_free(context); } int main(int argc, char **argv) { diff --git a/include/zenoh.h b/include/zenoh.h index 94f90c2c4..444caf082 100644 --- a/include/zenoh.h +++ b/include/zenoh.h @@ -40,4 +40,5 @@ extern "C" { } #endif #include "zenoh_macros.h" +#include "zenoh_memory.h" #endif diff --git a/include/zenoh_memory.h b/include/zenoh_memory.h new file mode 100644 index 000000000..0cf2a095a --- /dev/null +++ b/include/zenoh_memory.h @@ -0,0 +1,7 @@ +#pragma once +#include + +/*------------------ Memory ------------------*/ +static inline void *z_malloc(size_t size) { return malloc(size); } +static inline void *z_realloc(void *ptr, size_t size) {return realloc(ptr, size); } +static inline void z_free(void *ptr) {return free(ptr); } \ No newline at end of file diff --git a/tests/z_api_alignment_test.c b/tests/z_api_alignment_test.c index 98ac3bc94..ee63017c2 100644 --- a/tests/z_api_alignment_test.c +++ b/tests/z_api_alignment_test.c @@ -138,7 +138,7 @@ int main(int argc, char **argv) { sleep(SLEEP); size_t keyexpr_len = strlen(URI); - char *keyexpr_str = (char *)malloc(keyexpr_len + 1); + char *keyexpr_str = (char *)z_malloc(keyexpr_len + 1); memcpy(keyexpr_str, URI, keyexpr_len); keyexpr_str[keyexpr_len] = '\0'; int8_t _ret_int8 = z_keyexpr_is_canon(keyexpr_str, keyexpr_len); @@ -374,7 +374,7 @@ int main(int argc, char **argv) { sleep(SLEEP * 5); - free(keyexpr_str); + z_free(keyexpr_str); return 0; }