Skip to content

Commit

Permalink
Merge branch 'protocol_changes' into protocol_shmmut
Browse files Browse the repository at this point in the history
  • Loading branch information
Mallets committed Apr 26, 2024
2 parents 0983d58 + 1021261 commit 136beff
Show file tree
Hide file tree
Showing 112 changed files with 1,565 additions and 1,425 deletions.
11 changes: 0 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion commons/zenoh-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use validated_struct::ValidatedMapAssociatedTypes;
pub use validated_struct::{GetError, ValidatedMap};
use zenoh_core::zlock;
pub use zenoh_protocol::core::{
whatami, EndPoint, Locator, Priority, WhatAmI, WhatAmIMatcher, WhatAmIMatcherVisitor, ZenohId,
whatami, EndPoint, Locator, WhatAmI, WhatAmIMatcher, WhatAmIMatcherVisitor, ZenohId,
};
use zenoh_protocol::{
core::{key_expr::OwnedKeyExpr, Bits},
Expand Down
2 changes: 1 addition & 1 deletion commons/zenoh-config/src/mode_dependent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use serde::{
use std::fmt;
use std::marker::PhantomData;
pub use zenoh_protocol::core::{
whatami, EndPoint, Locator, Priority, WhatAmI, WhatAmIMatcher, WhatAmIMatcherVisitor, ZenohId,
whatami, EndPoint, Locator, WhatAmI, WhatAmIMatcher, WhatAmIMatcherVisitor, ZenohId,
};

pub trait ModeDependent<T> {
Expand Down
2 changes: 1 addition & 1 deletion commons/zenoh-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ fn keformat_support(source: &str) -> proc_macro2::TokenStream {
let formatter_doc = format!("And instance of a formatter for `{source}`.");

quote! {
use ::zenoh::Result as ZResult;
use ::zenoh::core::Result as ZResult;
const FORMAT_INNER: ::zenoh::key_expr::format::KeFormat<'static, [::zenoh::key_expr::format::Segment<'static>; #len]> = unsafe {
::zenoh::key_expr::format::macro_support::const_new(#source, [#(#segments)*])
};
Expand Down
10 changes: 1 addition & 9 deletions examples/examples/z_alloc_shm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use zenoh::prelude::r#async::*;
use zenoh::shm::protocol_implementations::posix::posix_shared_memory_provider_backend::PosixSharedMemoryProviderBackend;
use zenoh::shm::protocol_implementations::posix::protocol_id::POSIX_PROTOCOL_ID;
use zenoh::shm::provider::shared_memory_provider::{
BlockOn, GarbageCollect, SharedMemoryProviderBuilder,
};
use zenoh::shm::provider::shared_memory_provider::{Deallocate, Defragment};
use zenoh::shm::provider::types::{AllocAlignment, MemoryLayout};
use zenoh::Result;

#[tokio::main]
async fn main() {
Expand All @@ -28,7 +20,7 @@ async fn main() {
run().await.unwrap()
}

async fn run() -> Result<()> {
async fn run() -> ZResult<()> {
// Construct an SHM backend
let backend = {
// NOTE: code in this block is a specific PosixSharedMemoryProviderBackend API.
Expand Down
1 change: 0 additions & 1 deletion examples/examples/z_delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh_examples::CommonArgs;

Expand Down
8 changes: 4 additions & 4 deletions examples/examples/z_formats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// ZettaScale Zenoh Team, <[email protected]>
//

use zenoh::prelude::keyexpr;
use zenoh::prelude as zenoh;

zenoh::kedefine!(
pub file_format: "user_id/${user_id:*}/file/${file:*/**}",
Expand All @@ -26,8 +26,8 @@ fn main() {
let ke = zenoh::keformat!(formatter, user_id = 42, file).unwrap();
println!("{formatter:?} => {ke}");
// Parsing
let settings_ke = keyexpr::new("user_id/30/settings/dark_mode").unwrap();
let settings_ke = zenoh::keyexpr::new("user_id/30/settings/dark_mode").unwrap();
let parsed = settings_format::parse(settings_ke).unwrap();
assert_eq!(parsed.user_id(), keyexpr::new("30").unwrap());
assert_eq!(parsed.setting(), keyexpr::new("dark_mode").ok());
assert_eq!(parsed.user_id(), zenoh::keyexpr::new("30").unwrap());
assert_eq!(parsed.setting(), zenoh::keyexpr::new("dark_mode").ok());
}
1 change: 0 additions & 1 deletion examples/examples/z_forward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh_examples::CommonArgs;
use zenoh_ext::SubscriberForward;
Expand Down
1 change: 0 additions & 1 deletion examples/examples/z_get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
//
use clap::Parser;
use std::time::Duration;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh_examples::CommonArgs;

Expand Down
1 change: 0 additions & 1 deletion examples/examples/z_get_liveliness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
//
use clap::Parser;
use std::time::Duration;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh_examples::CommonArgs;

Expand Down
1 change: 0 additions & 1 deletion examples/examples/z_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh_examples::CommonArgs;

Expand Down
1 change: 0 additions & 1 deletion examples/examples/z_liveliness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh_examples::CommonArgs;

Expand Down
2 changes: 0 additions & 2 deletions examples/examples/z_ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
//
use clap::Parser;
use std::time::{Duration, Instant};
use zenoh::config::Config;
use zenoh::prelude::sync::*;
use zenoh::publication::CongestionControl;
use zenoh_examples::CommonArgs;

fn main() {
Expand Down
10 changes: 0 additions & 10 deletions examples/examples/z_ping_shm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,7 @@
//
use clap::Parser;
use std::time::{Duration, Instant};
use zenoh::buffers::ZSlice;
use zenoh::config::Config;
use zenoh::prelude::sync::*;
use zenoh::publication::CongestionControl;
use zenoh::shm::protocol_implementations::posix::{
posix_shared_memory_provider_backend::PosixSharedMemoryProviderBackend,
protocol_id::POSIX_PROTOCOL_ID,
};
use zenoh::shm::provider::shared_memory_provider::SharedMemoryProviderBuilder;
use zenoh::shm::provider::types::AllocAlignment;
use zenoh::shm::provider::types::MemoryLayout;
use zenoh_examples::CommonArgs;

fn main() {
Expand Down
2 changes: 0 additions & 2 deletions examples/examples/z_pong.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::config::Config;
use zenoh::prelude::sync::*;
use zenoh::publication::CongestionControl;
use zenoh_examples::CommonArgs;

fn main() {
Expand Down
1 change: 0 additions & 1 deletion examples/examples/z_pub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
//
use clap::Parser;
use std::time::Duration;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh_examples::CommonArgs;

Expand Down
11 changes: 1 addition & 10 deletions examples/examples/z_pub_shm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,13 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh::shm::protocol_implementations::posix::{
posix_shared_memory_provider_backend::PosixSharedMemoryProviderBackend,
protocol_id::POSIX_PROTOCOL_ID,
};
use zenoh::shm::provider::shared_memory_provider::SharedMemoryProviderBuilder;
use zenoh::shm::provider::shared_memory_provider::{BlockOn, GarbageCollect};
use zenoh::shm::provider::types::AllocAlignment;
use zenoh::shm::provider::types::MemoryLayout;
use zenoh_examples::CommonArgs;

const N: usize = 10;

#[tokio::main]
async fn main() -> Result<(), zenoh::Error> {
async fn main() -> Result<(), ZError> {
// Initiate logging
zenoh_util::try_init_log_from_env();

Expand Down
10 changes: 0 additions & 10 deletions examples/examples/z_pub_shm_thr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,7 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::buffers::ZSlice;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh::publication::CongestionControl;
use zenoh::shm::protocol_implementations::posix::{
posix_shared_memory_provider_backend::PosixSharedMemoryProviderBackend,
protocol_id::POSIX_PROTOCOL_ID,
};
use zenoh::shm::provider::shared_memory_provider::SharedMemoryProviderBuilder;
use zenoh::shm::provider::types::AllocAlignment;
use zenoh::shm::provider::types::MemoryLayout;
use zenoh_examples::CommonArgs;

#[tokio::main]
Expand Down
1 change: 0 additions & 1 deletion examples/examples/z_pub_thr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use clap::Parser;
use std::convert::TryInto;
use zenoh::prelude::sync::*;
use zenoh::publication::CongestionControl;
use zenoh_examples::CommonArgs;

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/z_pull.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//
use clap::Parser;
use std::time::Duration;
use zenoh::{config::Config, handlers::RingChannel, prelude::r#async::*};
use zenoh::prelude::r#async::*;
use zenoh_examples::CommonArgs;

#[tokio::main]
Expand Down
1 change: 0 additions & 1 deletion examples/examples/z_put.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh_examples::CommonArgs;

Expand Down
1 change: 0 additions & 1 deletion examples/examples/z_put_float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh_examples::CommonArgs;

Expand Down
1 change: 0 additions & 1 deletion examples/examples/z_queryable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh_examples::CommonArgs;

Expand Down
4 changes: 1 addition & 3 deletions examples/examples/z_scout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh::scouting::WhatAmI;

#[tokio::main]
async fn main() {
// initiate logging
zenoh_util::try_init_log_from_env();

println!("Scouting...");
let receiver = zenoh::scout(WhatAmI::Peer | WhatAmI::Router, Config::default())
let receiver = scout(WhatAmI::Peer | WhatAmI::Router, Config::default())
.res()
.await
.unwrap();
Expand Down
1 change: 0 additions & 1 deletion examples/examples/z_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use clap::Parser;
use futures::select;
use std::collections::HashMap;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh_examples::CommonArgs;

Expand Down
1 change: 0 additions & 1 deletion examples/examples/z_sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh_examples::CommonArgs;

Expand Down
1 change: 0 additions & 1 deletion examples/examples/z_sub_liveliness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh_examples::CommonArgs;

Expand Down
1 change: 0 additions & 1 deletion examples/examples/z_sub_shm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use clap::Parser;
use zenoh::config::Config;
use zenoh::prelude::r#async::*;
use zenoh::shm::slice::zsliceshm::zsliceshm;
use zenoh_examples::CommonArgs;

#[tokio::main]
Expand Down
1 change: 0 additions & 1 deletion examples/examples/z_sub_thr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
//
use clap::Parser;
use std::time::Instant;
use zenoh::config::Config;
use zenoh::prelude::sync::*;
use zenoh_examples::CommonArgs;

Expand Down
2 changes: 1 addition & 1 deletion plugins/zenoh-backend-example/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use async_std::sync::RwLock;
use async_trait::async_trait;
use std::collections::{hash_map::Entry, HashMap};
use zenoh::{prelude::OwnedKeyExpr, time::Timestamp, value::Value};
use zenoh::{key_expr::OwnedKeyExpr, time::Timestamp, value::Value};
use zenoh_backend_traits::{
config::{StorageConfig, VolumeConfig},
Capability, History, Persistence, Storage, StorageInsertionResult, StoredData, Volume,
Expand Down
2 changes: 1 addition & 1 deletion plugins/zenoh-backend-traits/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use schemars::JsonSchema;
use serde_json::{Map, Value};
use std::convert::TryFrom;
use std::time::Duration;
use zenoh::{key_expr::keyexpr, prelude::OwnedKeyExpr, Result as ZResult};
use zenoh::{core::Result as ZResult, key_expr::keyexpr, key_expr::OwnedKeyExpr};
use zenoh_plugin_trait::{PluginStartArgs, StructVersion};
use zenoh_result::{bail, zerror, Error};

Expand Down
8 changes: 3 additions & 5 deletions plugins/zenoh-backend-traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@
//! use std::sync::Arc;
//! use async_trait::async_trait;
//! use zenoh::prelude::r#async::*;
//! use zenoh::time::Timestamp;
//! use zenoh_backend_traits::*;
//! use zenoh_backend_traits::config::*;
//! use zenoh::Result as ZResult;
//!
//! #[no_mangle]
//! pub fn create_volume(config: VolumeConfig) -> ZResult<Box<dyn Volume>> {
Expand Down Expand Up @@ -125,10 +123,10 @@
use async_trait::async_trait;
use const_format::concatcp;
use zenoh::prelude::OwnedKeyExpr;
use zenoh::core::Result as ZResult;
use zenoh::key_expr::{keyexpr, OwnedKeyExpr};
use zenoh::time::Timestamp;
use zenoh::value::Value;
pub use zenoh::Result as ZResult;
use zenoh_plugin_trait::{PluginControl, PluginInstance, PluginStatusRec, StructVersion};
use zenoh_util::concat_enabled_features;

Expand Down Expand Up @@ -212,7 +210,7 @@ impl StructVersion for VolumeInstance {
}

impl PluginControl for VolumeInstance {
fn plugins_status(&self, _names: &zenoh::prelude::keyexpr) -> Vec<PluginStatusRec> {
fn plugins_status(&self, _names: &keyexpr) -> Vec<PluginStatusRec> {
Vec::new()
}
}
Expand Down
Loading

0 comments on commit 136beff

Please sign in to comment.