From 3744075e5afb10054165a6eac9f4c2fa0be240ac Mon Sep 17 00:00:00 2001 From: Diogo Matsubara Date: Tue, 17 Dec 2024 11:30:17 +0100 Subject: [PATCH 1/5] fix: pin home to 0.5.9 (#1673) 0.5.11 requires rustc 1.81 so we pin the dependency to the latest one working with the 1.70 series. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index c0826648ba..8ad505ec67 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -105,7 +105,7 @@ git-version = "0.3.9" hashbrown = "0.14" hex = { version = "0.4.3", default-features = false } # Default features are disabled due to usage in no_std crates hmac = { version = "0.12.1", features = ["std"] } -home = "0.5.9" +home = "=0.5.9" http-types = "2.12.0" humantime = "2.1.0" itertools = "0.13.0" From f6f7ea4867718c944cdfb4c57f7751858ad1facf Mon Sep 17 00:00:00 2001 From: Diogo Matsubara Date: Wed, 18 Dec 2024 09:41:30 +0100 Subject: [PATCH 2/5] fix: exclude internal from automatic changelog (#1677) Don't include PRs labeled as internal in the automatically generated changelog --- .github/release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/release.yml b/.github/release.yml index 23d56cfb1a..92919932b9 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -32,4 +32,7 @@ changelog: - dependencies - title: Other changes labels: - - "*" \ No newline at end of file + - "*" + exclude: + labels: + - internal \ No newline at end of file From f3f092450d3ec12c7879e25958b73dd3ce089541 Mon Sep 17 00:00:00 2001 From: "ChenYing Kuo (CY)" Date: Wed, 18 Dec 2024 16:49:30 +0800 Subject: [PATCH 3/5] Switch to another markdown lint CI check (#1675) Signed-off-by: ChenYing Kuo --- .github/workflows/ci.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28ccb7b8c1..24159075a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -190,12 +190,11 @@ jobs: markdown_lint: runs-on: ubuntu-latest steps: - - uses: articulate/actions-markdownlint@v1 + - uses: actions/checkout@v4 + - uses: DavidAnson/markdownlint-cli2-action@v18 with: - config: .markdownlint.yaml - files: '*.md' - ignore: target - version: 0.28.1 + config: '.markdownlint.yaml' + globs: '**/README.md' # NOTE: In GitHub repository settings, the "Require status checks to pass # before merging" branch protection rule ensures that commits are only merged @@ -205,7 +204,7 @@ jobs: ci: name: CI status checks runs-on: ubuntu-latest - needs: [check, test, valgrind, typos] + needs: [check, test, valgrind, typos, markdown_lint] if: always() steps: - name: Check whether all jobs pass From a6bc509b5997c922a56253455149858af715edfa Mon Sep 17 00:00:00 2001 From: yellowhatter <104833606+yellowhatter@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:28:14 +0300 Subject: [PATCH 4/5] Shm mutation example (#1672) Add SHM buffer mutation functionality to examples Add payload_mut accessor to ReplyError --- examples/examples/z_sub_shm.rs | 46 +++++++++++++--------------------- zenoh/src/api/query.rs | 6 +++++ 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/examples/examples/z_sub_shm.rs b/examples/examples/z_sub_shm.rs index f49b0628bf..98137b7dcb 100644 --- a/examples/examples/z_sub_shm.rs +++ b/examples/examples/z_sub_shm.rs @@ -14,6 +14,8 @@ use std::borrow::Cow; use clap::Parser; +#[cfg(all(feature = "shared-memory", feature = "unstable"))] +use zenoh::shm::{zshm, zshmmut}; use zenoh::{bytes::ZBytes, config::Config, key_expr::KeyExpr}; use zenoh_examples::CommonArgs; @@ -31,43 +33,25 @@ async fn main() { let subscriber = session.declare_subscriber(&key_expr).await.unwrap(); println!("Press CTRL-C to quit..."); - while let Ok(sample) = subscriber.recv_async().await { + while let Ok(mut sample) = subscriber.recv_async().await { + let kind = sample.kind(); + let key_str = sample.key_expr().as_str().to_owned(); + // Print overall payload information - let (payload_type, payload) = handle_bytes(sample.payload()); + let (payload_type, payload) = handle_bytes(sample.payload_mut()); print!( ">> [Subscriber] Received {} ('{}': '{}') [{}] ", - sample.kind(), - sample.key_expr().as_str(), - payload, - payload_type, + kind, key_str, payload, payload_type, ); // Print attachment information - if let Some(att) = sample.attachment() { + if let Some(att) = sample.attachment_mut() { let (attachment_type, attachment) = handle_bytes(att); print!(" ({}: {})", attachment_type, attachment); } println!(); } - - // // Try to get a mutable reference to the SHM buffer. If this subscriber is the only subscriber - // // holding a reference to the SHM buffer, then it will be able to get a mutable reference to it. - // // With the mutable reference at hand, it's possible to mutate in place the SHM buffer content. - - // while let Ok(mut sample) = subscriber.recv_async().await { - // let kind = sample.kind(); - // let key_expr = sample.key_expr().to_string(); - // match sample.payload_mut().as_shm_mut() { - // Ok(payload) => println!( - // ">> [Subscriber] Received {} ('{}': '{:02x?}')", - // kind, key_expr, payload - // ), - // Err(e) => { - // println!(">> [Subscriber] Not a ShmBufInner: {:?}", e); - // } - // } - // } } #[derive(clap::Parser, Clone, PartialEq, Eq, Hash, Debug)] @@ -84,7 +68,7 @@ fn parse_args() -> (Config, KeyExpr<'static>) { (args.common.into(), args.key) } -fn handle_bytes(bytes: &ZBytes) -> (&str, Cow) { +fn handle_bytes(bytes: &mut ZBytes) -> (&str, Cow) { // Determine buffer type for indication purpose let bytes_type = { // if Zenoh is built without SHM support, the only buffer type it can receive is RAW @@ -100,10 +84,14 @@ fn handle_bytes(bytes: &ZBytes) -> (&str, Cow) { "UNKNOWN" } - // if Zenoh is built with SHM support and with SHM API we can detect the exact buffer type + // if Zenoh is built with SHM support and with SHM API we can detect the exact buffer type #[cfg(all(feature = "shared-memory", feature = "unstable"))] - match bytes.as_shm() { - Some(_) => "SHM", + match bytes.as_shm_mut() { + // try to mutate SHM buffer to get it's mutability property + Some(shm) => match <&mut zshm as TryInto<&mut zshmmut>>::try_into(shm) { + Ok(_shm_mut) => "SHM (MUT)", + Err(_) => "SHM (IMMUT)", + }, None => "RAW", } }; diff --git a/zenoh/src/api/query.rs b/zenoh/src/api/query.rs index 3e1f66ed12..1d763dece8 100644 --- a/zenoh/src/api/query.rs +++ b/zenoh/src/api/query.rs @@ -86,6 +86,12 @@ impl ReplyError { &self.payload } + /// Gets the mutable payload of this ReplyError. + #[inline] + pub fn payload_mut(&mut self) -> &mut ZBytes { + &mut self.payload + } + /// Gets the encoding of this ReplyError. #[inline] pub fn encoding(&self) -> &Encoding { From 9640d2245204ebcb2ed3f424a5178f832315df7b Mon Sep 17 00:00:00 2001 From: Oussama Teffahi <70609372+oteffahi@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:52:33 +0100 Subject: [PATCH 5/5] Use keyexpr lifetime as lifetime of AdvancedPublisher (#1671) --- zenoh-ext/src/advanced_publisher.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/zenoh-ext/src/advanced_publisher.rs b/zenoh-ext/src/advanced_publisher.rs index 023e509d57..9afc2fb091 100644 --- a/zenoh-ext/src/advanced_publisher.rs +++ b/zenoh-ext/src/advanced_publisher.rs @@ -203,8 +203,8 @@ impl QoSBuilderTrait for AdvancedPublisherBuilder<'_, '_, '_> { } #[zenoh_macros::unstable] -impl<'a> Resolvable for AdvancedPublisherBuilder<'a, '_, '_> { - type To = ZResult>; +impl<'b> Resolvable for AdvancedPublisherBuilder<'_, 'b, '_> { + type To = ZResult>; } #[zenoh_macros::unstable] @@ -238,7 +238,7 @@ pub struct AdvancedPublisher<'a> { #[zenoh_macros::unstable] impl<'a> AdvancedPublisher<'a> { #[zenoh_macros::unstable] - fn new(conf: AdvancedPublisherBuilder<'a, '_, '_>) -> ZResult { + fn new(conf: AdvancedPublisherBuilder<'_, 'a, '_>) -> ZResult { let key_expr = conf.pub_key_expr?; let meta = match conf.meta_key_expr { Some(meta) => Some(meta?), @@ -247,7 +247,7 @@ impl<'a> AdvancedPublisher<'a> { let publisher = conf .session - .declare_publisher(key_expr.clone().into_owned()) + .declare_publisher(key_expr.clone()) .encoding(conf.encoding) .allowed_destination(conf.destination) .reliability(conf.reliability) @@ -286,7 +286,7 @@ impl<'a> AdvancedPublisher<'a> { let cache = if conf.cache { Some( - AdvancedCacheBuilder::new(conf.session, Ok(key_expr.clone().into_owned())) + AdvancedCacheBuilder::new(conf.session, Ok(key_expr.clone())) .history(conf.history) .queryable_prefix(&prefix) .wait()?,