From 969f05a223d7f973877fcaf6266e0961999d2fc8 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Thu, 8 Feb 2024 18:48:12 +0100 Subject: [PATCH 1/9] trait import added --- Cargo.lock | 78 +++++++++++++++++++++++++++++++++------------------ Cargo.toml | 10 +++---- Cargo.toml.in | 8 +++--- src/info.rs | 3 +- 4 files changed, 62 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 14f458af2..593220380 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,13 +30,14 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.3" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" dependencies = [ "cfg-if", "once_cell", "version_check", + "zerocopy", ] [[package]] @@ -2971,7 +2972,7 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "zenoh" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "async-global-executor", "async-std", @@ -3020,7 +3021,7 @@ dependencies = [ [[package]] name = "zenoh-buffers" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "zenoh-collections", ] @@ -3050,7 +3051,7 @@ dependencies = [ [[package]] name = "zenoh-codec" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "log", "serde", @@ -3063,12 +3064,12 @@ dependencies = [ [[package]] name = "zenoh-collections" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" [[package]] name = "zenoh-config" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "flume", "json5", @@ -3087,7 +3088,7 @@ dependencies = [ [[package]] name = "zenoh-core" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "async-std", "lazy_static", @@ -3097,7 +3098,7 @@ dependencies = [ [[package]] name = "zenoh-crypto" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "aes", "hmac", @@ -3110,7 +3111,7 @@ dependencies = [ [[package]] name = "zenoh-ext" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "async-std", "bincode", @@ -3130,7 +3131,7 @@ dependencies = [ [[package]] name = "zenoh-keyexpr" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "hashbrown 0.14.0", "keyed-set", @@ -3144,7 +3145,7 @@ dependencies = [ [[package]] name = "zenoh-link" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "async-std", "async-trait", @@ -3163,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#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "async-std", "async-trait", @@ -3180,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#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "async-rustls", "async-std", @@ -3206,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#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "async-std", "async-trait", @@ -3222,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#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "async-rustls", "async-std", @@ -3247,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#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "async-std", "async-trait", @@ -3266,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#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "async-std", "async-trait", @@ -3284,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#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "async-std", "async-trait", @@ -3304,7 +3305,7 @@ dependencies = [ [[package]] name = "zenoh-macros" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "proc-macro2", "quote", @@ -3317,11 +3318,14 @@ dependencies = [ [[package]] name = "zenoh-plugin-trait" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ + "const_format", "libloading", "log", + "serde", "serde_json", + "zenoh-keyexpr", "zenoh-macros", "zenoh-result", "zenoh-util", @@ -3330,7 +3334,7 @@ dependencies = [ [[package]] name = "zenoh-protocol" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "const_format", "hex", @@ -3346,7 +3350,7 @@ dependencies = [ [[package]] name = "zenoh-result" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "anyhow", ] @@ -3354,7 +3358,7 @@ dependencies = [ [[package]] name = "zenoh-shm" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "bincode", "log", @@ -3367,7 +3371,7 @@ dependencies = [ [[package]] name = "zenoh-sync" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "async-std", "event-listener 4.0.0", @@ -3382,7 +3386,7 @@ dependencies = [ [[package]] name = "zenoh-transport" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "async-executor", "async-global-executor", @@ -3414,7 +3418,7 @@ dependencies = [ [[package]] name = "zenoh-util" version = "0.11.0-dev" -source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#b669489bc814a758741f09c671ecc3a0683697a0" +source = "git+https://github.com/eclipse-zenoh/zenoh.git?branch=main#2bd4518334d0a9e7e2703c7fd57dfa4547a96819" dependencies = [ "async-std", "async-trait", @@ -3438,6 +3442,26 @@ dependencies = [ "zenoh-result", ] +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.33", +] + [[package]] name = "zeroize" version = "1.6.0" diff --git a/Cargo.toml b/Cargo.toml index 52deaa71c..839c3602c 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 = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory", "unstable"], default-features = false } +zenoh-protocol = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory"] } +zenoh-util = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" } +zenoh-ext = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["unstable"] } [build-dependencies] cbindgen = "0.24.3" @@ -61,7 +61,7 @@ serde_yaml = "0.9.19" [lib] path="src/lib.rs" -name = "zenohc" +name = "zenohcd" crate-type = ["cdylib", "staticlib"] doctest = false diff --git a/Cargo.toml.in b/Cargo.toml.in index 86bb48865..80ff02225 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 = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory", "unstable"], default-features = false } +zenoh-protocol = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory"] } +zenoh-util = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" } +zenoh-ext = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["unstable"] } [build-dependencies] cbindgen = "0.24.3" diff --git a/src/info.rs b/src/info.rs index 237a62dbb..53acb7d21 100644 --- a/src/info.rs +++ b/src/info.rs @@ -12,8 +12,9 @@ // ZettaScale Zenoh team, // use crate::{session::*, z_closure_zid_call, z_owned_closure_zid_t}; -use zenoh::prelude::sync::SyncResolve; +use zenoh::SessionDeclarations; use zenoh_protocol::core::ZenohId; +use zenoh_util::core::SyncResolve; /// Represents a Zenoh ID. /// From 1591909710cca65d7a7a0280eb4c3142c116f8f2 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Mon, 12 Feb 2024 16:44:42 +0300 Subject: [PATCH 2/9] queryable_complete option added tp pub cache --- .gitignore | 1 + examples/z_pub_cache.c | 1 + include/zenoh_commons.h | 2 ++ src/publication_cache.rs | 4 ++++ 4 files changed, 8 insertions(+) diff --git a/.gitignore b/.gitignore index 85185b5b6..d7a6cf967 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ target # vscode .vscode +out # IntelliJ / CLion .idea diff --git a/examples/z_pub_cache.c b/examples/z_pub_cache.c index b293197a7..8c1d36221 100644 --- a/examples/z_pub_cache.c +++ b/examples/z_pub_cache.c @@ -54,6 +54,7 @@ int main(int argc, char **argv) { ze_publication_cache_options_t pub_cache_opts = ze_publication_cache_options_default(); pub_cache_opts.history = 42; + pub_cache_opts.queryable_complete = false; printf("Declaring publication cache on '%s'...\n", keyexpr); ze_owned_publication_cache_t pub_cache = diff --git a/include/zenoh_commons.h b/include/zenoh_commons.h index 63df84a33..3cf971cb7 100644 --- a/include/zenoh_commons.h +++ b/include/zenoh_commons.h @@ -905,12 +905,14 @@ typedef struct ze_owned_publication_cache_t { * z_keyexpr_t queryable_prefix: The prefix used for queryable * zcu_locality_t queryable_origin: The restriction for the matching queries that will be receive by this * publication cache + * bool complete: the `complete` option for the queryable * size_t history: The the history size * size_t resources_limit: The limit number of cached resources */ typedef struct ze_publication_cache_options_t { struct z_keyexpr_t queryable_prefix; enum zcu_locality_t queryable_origin; + bool queryable_complete; size_t history; size_t resources_limit; } ze_publication_cache_options_t; diff --git a/src/publication_cache.rs b/src/publication_cache.rs index 701dff31a..75daa9818 100644 --- a/src/publication_cache.rs +++ b/src/publication_cache.rs @@ -29,12 +29,14 @@ use crate::{ /// z_keyexpr_t queryable_prefix: The prefix used for queryable /// zcu_locality_t queryable_origin: The restriction for the matching queries that will be receive by this /// publication cache +/// bool complete: the `complete` option for the queryable /// size_t history: The the history size /// size_t resources_limit: The limit number of cached resources #[repr(C)] pub struct ze_publication_cache_options_t { pub queryable_prefix: z_keyexpr_t, pub queryable_origin: zcu_locality_t, + pub queryable_complete: bool, pub history: usize, pub resources_limit: usize, } @@ -45,6 +47,7 @@ pub extern "C" fn ze_publication_cache_options_default() -> ze_publication_cache ze_publication_cache_options_t { queryable_prefix: z_keyexpr_t::null(), queryable_origin: zcu_locality_default(), + queryable_complete: false, history: 1, resources_limit: 0, } @@ -133,6 +136,7 @@ pub extern "C" fn ze_declare_publication_cache( if let Some(options) = options { p = p.history(options.history); p = p.queryable_allowed_origin(options.queryable_origin.into()); + p = p.queryable_complete(options.queryable_complete); if options.resources_limit != 0 { p = p.resources_limit(options.resources_limit) } From 7f2b7dbc777c1af74cbc1e9017dfa4ddf4071ea4 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Mon, 12 Feb 2024 20:18:05 +0300 Subject: [PATCH 3/9] comment fix --- Cargo.toml | 2 +- include/zenoh_commons.h | 2 +- src/publication_cache.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 839c3602c..dabcce36d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,7 +61,7 @@ serde_yaml = "0.9.19" [lib] path="src/lib.rs" -name = "zenohcd" +name = "zenohc" crate-type = ["cdylib", "staticlib"] doctest = false diff --git a/include/zenoh_commons.h b/include/zenoh_commons.h index 3cf971cb7..58e7a2856 100644 --- a/include/zenoh_commons.h +++ b/include/zenoh_commons.h @@ -905,7 +905,7 @@ typedef struct ze_owned_publication_cache_t { * z_keyexpr_t queryable_prefix: The prefix used for queryable * zcu_locality_t queryable_origin: The restriction for the matching queries that will be receive by this * publication cache - * bool complete: the `complete` option for the queryable + * bool queryable_complete: the `complete` option for the queryable * size_t history: The the history size * size_t resources_limit: The limit number of cached resources */ diff --git a/src/publication_cache.rs b/src/publication_cache.rs index 75daa9818..5b96a904c 100644 --- a/src/publication_cache.rs +++ b/src/publication_cache.rs @@ -29,7 +29,7 @@ use crate::{ /// z_keyexpr_t queryable_prefix: The prefix used for queryable /// zcu_locality_t queryable_origin: The restriction for the matching queries that will be receive by this /// publication cache -/// bool complete: the `complete` option for the queryable +/// bool queryable_complete: the `complete` option for the queryable /// size_t history: The the history size /// size_t resources_limit: The limit number of cached resources #[repr(C)] From 6837017ed9194fbc00b655dc66d1df3fde88183a Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 13 Feb 2024 16:42:51 +0300 Subject: [PATCH 4/9] tag update --- include/zenoh_commons.h | 11 +++++++++++ src/commons.rs | 12 ++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/include/zenoh_commons.h b/include/zenoh_commons.h index 63df84a33..4dff770d7 100644 --- a/include/zenoh_commons.h +++ b/include/zenoh_commons.h @@ -135,6 +135,9 @@ typedef enum z_reliability_t { Z_RELIABILITY_BEST_EFFORT, Z_RELIABILITY_RELIABLE, } z_reliability_t; +/** + * tags{options.sample.kind} + */ typedef enum z_sample_kind_t { Z_SAMPLE_KIND_PUT = 0, Z_SAMPLE_KIND_DELETE = 1, @@ -394,6 +397,9 @@ typedef struct z_encoding_t { enum z_encoding_prefix_t prefix; struct z_bytes_t suffix; } z_encoding_t; +/** + * tags{options.timestamp} + */ typedef struct z_timestamp_t { uint64_t time; struct z_id_t id; @@ -827,6 +833,7 @@ typedef struct zc_owned_liveliness_get_options_t { * * Should this invariant be broken when the payload is passed to one of zenoh's `put_owned` * functions, then the operation will fail (but the passed value will still be consumed). + * tags{zbuf} */ typedef struct zc_owned_payload_t { struct z_bytes_t payload; @@ -2004,6 +2011,7 @@ ZENOHC_API struct z_subscriber_options_t z_subscriber_options_default(void); ZENOHC_API int8_t z_subscriber_pull(struct z_pull_subscriber_t sub); /** * Returns ``true`` if `ts` is a valid timestamp + * tags{timestamp.check} */ ZENOHC_API bool z_timestamp_check(struct z_timestamp_t ts); /** @@ -2196,14 +2204,17 @@ ZENOHC_API struct zc_owned_liveliness_token_t zc_liveliness_token_null(void); ZENOHC_API void zc_liveliness_undeclare_token(struct zc_owned_liveliness_token_t *token); /** * Returns `false` if `payload` is the gravestone value. + * tags{zbuf.check} */ ZENOHC_API bool zc_payload_check(const struct zc_owned_payload_t *payload); /** * Decrements `payload`'s backing refcount, releasing the memory if appropriate. + * tags{zbuf.drop} */ ZENOHC_API void zc_payload_drop(struct zc_owned_payload_t *payload); /** * Constructs `zc_owned_payload_t`'s gravestone value. + * tags{zbuf.null} */ ZENOHC_API struct zc_owned_payload_t zc_payload_null(void); /** diff --git a/src/commons.rs b/src/commons.rs index 5d58663eb..dcb637854 100644 --- a/src/commons.rs +++ b/src/commons.rs @@ -34,9 +34,10 @@ pub type z_zint_t = c_ulong; #[allow(non_camel_case_types)] #[repr(C)] #[derive(Clone, Copy, Debug)] +/// tags{options.sample.kind} pub enum z_sample_kind_t { - PUT = 0, - DELETE = 1, + PUT = 0, // tags{options.sample.kind.put} + DELETE = 1,// tags{options.sample.kind.delete} } impl From for z_sample_kind_t { @@ -58,12 +59,14 @@ impl From for SampleKind { } #[repr(C)] +/// tags{options.timestamp} pub struct z_timestamp_t { time: u64, id: z_id_t, } /// Returns ``true`` if `ts` is a valid timestamp +/// tags{timestamp.check} #[no_mangle] pub extern "C" fn z_timestamp_check(ts: z_timestamp_t) -> bool { ts.id.id.iter().any(|byte| *byte != 0) @@ -96,6 +99,7 @@ impl From> for z_timestamp_t { /// /// Should this invariant be broken when the payload is passed to one of zenoh's `put_owned` /// functions, then the operation will fail (but the passed value will still be consumed). +/// tags{zbuf} #[allow(non_camel_case_types)] #[repr(C)] pub struct zc_owned_payload_t { @@ -120,6 +124,7 @@ impl TryFrom for zc_owned_payload_t { } } impl zc_owned_payload_t { + /// tags{} pub fn take(&mut self) -> Option { if !z_bytes_check(&self.payload) { return None; @@ -167,16 +172,19 @@ pub extern "C" fn zc_payload_rcinc(payload: &zc_owned_payload_t) -> zc_owned_pay } } /// Returns `false` if `payload` is the gravestone value. +/// tags{zbuf.check} #[no_mangle] pub extern "C" fn zc_payload_check(payload: &zc_owned_payload_t) -> bool { !payload.payload.start.is_null() } /// Decrements `payload`'s backing refcount, releasing the memory if appropriate. +/// tags{zbuf.drop} #[no_mangle] pub extern "C" fn zc_payload_drop(payload: &mut zc_owned_payload_t) { unsafe { std::ptr::replace(payload, zc_payload_null()) }; } /// Constructs `zc_owned_payload_t`'s gravestone value. +/// tags{zbuf.null} #[no_mangle] pub extern "C" fn zc_payload_null() -> zc_owned_payload_t { zc_owned_payload_t { From 52983addc73eb8c13219f389aa24d2398c275a2b Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Tue, 13 Feb 2024 16:49:49 +0300 Subject: [PATCH 5/9] tags undoed --- include/zenoh_commons.h | 11 ----------- src/commons.rs | 12 ++---------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/include/zenoh_commons.h b/include/zenoh_commons.h index 46a3cb302..58e7a2856 100644 --- a/include/zenoh_commons.h +++ b/include/zenoh_commons.h @@ -135,9 +135,6 @@ typedef enum z_reliability_t { Z_RELIABILITY_BEST_EFFORT, Z_RELIABILITY_RELIABLE, } z_reliability_t; -/** - * tags{options.sample.kind} - */ typedef enum z_sample_kind_t { Z_SAMPLE_KIND_PUT = 0, Z_SAMPLE_KIND_DELETE = 1, @@ -397,9 +394,6 @@ typedef struct z_encoding_t { enum z_encoding_prefix_t prefix; struct z_bytes_t suffix; } z_encoding_t; -/** - * tags{options.timestamp} - */ typedef struct z_timestamp_t { uint64_t time; struct z_id_t id; @@ -833,7 +827,6 @@ typedef struct zc_owned_liveliness_get_options_t { * * Should this invariant be broken when the payload is passed to one of zenoh's `put_owned` * functions, then the operation will fail (but the passed value will still be consumed). - * tags{zbuf} */ typedef struct zc_owned_payload_t { struct z_bytes_t payload; @@ -2013,7 +2006,6 @@ ZENOHC_API struct z_subscriber_options_t z_subscriber_options_default(void); ZENOHC_API int8_t z_subscriber_pull(struct z_pull_subscriber_t sub); /** * Returns ``true`` if `ts` is a valid timestamp - * tags{timestamp.check} */ ZENOHC_API bool z_timestamp_check(struct z_timestamp_t ts); /** @@ -2206,17 +2198,14 @@ ZENOHC_API struct zc_owned_liveliness_token_t zc_liveliness_token_null(void); ZENOHC_API void zc_liveliness_undeclare_token(struct zc_owned_liveliness_token_t *token); /** * Returns `false` if `payload` is the gravestone value. - * tags{zbuf.check} */ ZENOHC_API bool zc_payload_check(const struct zc_owned_payload_t *payload); /** * Decrements `payload`'s backing refcount, releasing the memory if appropriate. - * tags{zbuf.drop} */ ZENOHC_API void zc_payload_drop(struct zc_owned_payload_t *payload); /** * Constructs `zc_owned_payload_t`'s gravestone value. - * tags{zbuf.null} */ ZENOHC_API struct zc_owned_payload_t zc_payload_null(void); /** diff --git a/src/commons.rs b/src/commons.rs index dcb637854..5d58663eb 100644 --- a/src/commons.rs +++ b/src/commons.rs @@ -34,10 +34,9 @@ pub type z_zint_t = c_ulong; #[allow(non_camel_case_types)] #[repr(C)] #[derive(Clone, Copy, Debug)] -/// tags{options.sample.kind} pub enum z_sample_kind_t { - PUT = 0, // tags{options.sample.kind.put} - DELETE = 1,// tags{options.sample.kind.delete} + PUT = 0, + DELETE = 1, } impl From for z_sample_kind_t { @@ -59,14 +58,12 @@ impl From for SampleKind { } #[repr(C)] -/// tags{options.timestamp} pub struct z_timestamp_t { time: u64, id: z_id_t, } /// Returns ``true`` if `ts` is a valid timestamp -/// tags{timestamp.check} #[no_mangle] pub extern "C" fn z_timestamp_check(ts: z_timestamp_t) -> bool { ts.id.id.iter().any(|byte| *byte != 0) @@ -99,7 +96,6 @@ impl From> for z_timestamp_t { /// /// Should this invariant be broken when the payload is passed to one of zenoh's `put_owned` /// functions, then the operation will fail (but the passed value will still be consumed). -/// tags{zbuf} #[allow(non_camel_case_types)] #[repr(C)] pub struct zc_owned_payload_t { @@ -124,7 +120,6 @@ impl TryFrom for zc_owned_payload_t { } } impl zc_owned_payload_t { - /// tags{} pub fn take(&mut self) -> Option { if !z_bytes_check(&self.payload) { return None; @@ -172,19 +167,16 @@ pub extern "C" fn zc_payload_rcinc(payload: &zc_owned_payload_t) -> zc_owned_pay } } /// Returns `false` if `payload` is the gravestone value. -/// tags{zbuf.check} #[no_mangle] pub extern "C" fn zc_payload_check(payload: &zc_owned_payload_t) -> bool { !payload.payload.start.is_null() } /// Decrements `payload`'s backing refcount, releasing the memory if appropriate. -/// tags{zbuf.drop} #[no_mangle] pub extern "C" fn zc_payload_drop(payload: &mut zc_owned_payload_t) { unsafe { std::ptr::replace(payload, zc_payload_null()) }; } /// Constructs `zc_owned_payload_t`'s gravestone value. -/// tags{zbuf.null} #[no_mangle] pub extern "C" fn zc_payload_null() -> zc_owned_payload_t { zc_owned_payload_t { From 840f446590a4d9589bc81e38c1171f1dd5c0ab7a Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Thu, 15 Feb 2024 02:25:34 +0300 Subject: [PATCH 6/9] zenoh version restored --- Cargo.toml.in | 8 ++++---- src/info.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml.in b/Cargo.toml.in index 80ff02225..f7771d6ac 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 = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory", "unstable"], default-features = false } -zenoh-protocol = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory"] } -zenoh-util = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" } -zenoh-ext = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["unstable"] } +zenoh = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory", "unstable"], default-features = false } +zenoh-protocol = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory"] } +zenoh-util = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" } +zenoh-ext = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["unstable"] } [build-dependencies] cbindgen = "0.24.3" diff --git a/src/info.rs b/src/info.rs index 53acb7d21..94d045f66 100644 --- a/src/info.rs +++ b/src/info.rs @@ -14,7 +14,7 @@ use crate::{session::*, z_closure_zid_call, z_owned_closure_zid_t}; use zenoh::SessionDeclarations; use zenoh_protocol::core::ZenohId; -use zenoh_util::core::SyncResolve; +use zenoh::prelude::sync::SyncResolve; /// Represents a Zenoh ID. /// From dccbc054608dd8bfb1f90ea177640e51358f687d Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Thu, 15 Feb 2024 02:27:26 +0300 Subject: [PATCH 7/9] cargo.coml update --- Cargo.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index dabcce36d..cfb6791b1 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 = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory", "unstable"], default-features = false } -zenoh-protocol = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory"] } -zenoh-util = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" } -zenoh-ext = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["unstable"] } +zenoh = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory", "unstable"], default-features = false } +zenoh-protocol = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory"] } +zenoh-util = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" } +zenoh-ext = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["unstable"] } [build-dependencies] cbindgen = "0.24.3" From fc05d557e01ea9ffe8ae2d98510383ae50ca44c5 Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Thu, 15 Feb 2024 11:43:55 +0300 Subject: [PATCH 8/9] restored version --- Cargo.toml | 8 ++++---- Cargo.toml.in | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cfb6791b1..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 = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory", "unstable"], default-features = false } -zenoh-protocol = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory"] } -zenoh-util = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" } -zenoh-ext = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", 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 f7771d6ac..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 = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory", "unstable"], default-features = false } -zenoh-protocol = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory"] } -zenoh-util = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" } -zenoh-ext = { version = "1.0.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", 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 2d4ed6af4a40e4ebc097ec7eadd6ec852d55bc5a Mon Sep 17 00:00:00 2001 From: Michael Ilyin Date: Thu, 15 Feb 2024 11:50:49 +0300 Subject: [PATCH 9/9] cargo fmt --- src/info.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.rs b/src/info.rs index 94d045f66..326b468bb 100644 --- a/src/info.rs +++ b/src/info.rs @@ -12,9 +12,9 @@ // ZettaScale Zenoh team, // use crate::{session::*, z_closure_zid_call, z_owned_closure_zid_t}; +use zenoh::prelude::sync::SyncResolve; use zenoh::SessionDeclarations; use zenoh_protocol::core::ZenohId; -use zenoh::prelude::sync::SyncResolve; /// Represents a Zenoh ID. ///