Skip to content

Commit

Permalink
Config in mod config
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin committed Oct 7, 2024
1 parent cab7352 commit 07844f5
Show file tree
Hide file tree
Showing 39 changed files with 244 additions and 226 deletions.
2 changes: 1 addition & 1 deletion examples/examples/z_delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::{key_expr::KeyExpr, Config};
use zenoh::{config::Config, key_expr::KeyExpr};
use zenoh_examples::CommonArgs;

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/z_forward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::{key_expr::KeyExpr, Config};
use zenoh::{config::Config, key_expr::KeyExpr};
use zenoh_examples::CommonArgs;
use zenoh_ext::SubscriberForward;

Expand Down
2 changes: 1 addition & 1 deletion examples/examples/z_get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use std::time::Duration;

use clap::Parser;
use zenoh::{
config::Config,
query::{QueryTarget, Selector},
Config,
};
use zenoh_examples::CommonArgs;

Expand Down
2 changes: 1 addition & 1 deletion examples/examples/z_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct Args {
common: CommonArgs,
}

fn parse_args() -> zenoh::Config {
fn parse_args() -> zenoh::config::Config {
let args = Args::parse();
args.common.into()
}
2 changes: 1 addition & 1 deletion examples/examples/z_ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use std::time::{Duration, Instant};

use clap::Parser;
use zenoh::{bytes::ZBytes, key_expr::keyexpr, qos::CongestionControl, Config, Wait};
use zenoh::{bytes::ZBytes, config::Config, key_expr::keyexpr, qos::CongestionControl, Wait};
use zenoh_examples::CommonArgs;

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/z_pong.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::{key_expr::keyexpr, qos::CongestionControl, Config, Wait};
use zenoh::{config::Config, key_expr::keyexpr, qos::CongestionControl, Wait};
use zenoh_examples::CommonArgs;

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/z_pub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use std::time::Duration;

use clap::Parser;
use zenoh::{bytes::Encoding, key_expr::KeyExpr, Config};
use zenoh::{bytes::Encoding, config::Config, key_expr::KeyExpr};
use zenoh_examples::CommonArgs;

#[tokio::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 @@ -14,7 +14,7 @@
use std::time::Duration;

use clap::Parser;
use zenoh::{handlers::RingChannel, key_expr::KeyExpr, Config};
use zenoh::{config::Config, handlers::RingChannel, key_expr::KeyExpr};
use zenoh_examples::CommonArgs;

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/z_put.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::{key_expr::KeyExpr, Config};
use zenoh::{config::Config, key_expr::KeyExpr};
use zenoh_examples::CommonArgs;

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/z_put_float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::{key_expr::KeyExpr, Config};
use zenoh::{config::Config, key_expr::KeyExpr};
use zenoh_examples::CommonArgs;
use zenoh_ext::z_serialize;

Expand Down
2 changes: 1 addition & 1 deletion examples/examples/z_queryable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::{key_expr::KeyExpr, Config};
use zenoh::{config::Config, key_expr::KeyExpr};
use zenoh_examples::CommonArgs;

#[tokio::main]
Expand Down
5 changes: 4 additions & 1 deletion examples/examples/z_scout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//
use zenoh::{config::WhatAmI, scout, Config};
use zenoh::{
config::{Config, WhatAmI},
scout,
};

#[tokio::main]
async fn main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/z_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ use std::collections::HashMap;
use clap::Parser;
use futures::select;
use zenoh::{
config::Config,
key_expr::{keyexpr, KeyExpr},
sample::{Sample, SampleKind},
Config,
};
use zenoh_examples::CommonArgs;

Expand Down
2 changes: 1 addition & 1 deletion examples/examples/z_sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::Parser;
use zenoh::{key_expr::KeyExpr, Config};
use zenoh::{config::Config, key_expr::KeyExpr};
use zenoh_examples::CommonArgs;

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/z_sub_thr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use std::time::Instant;

use clap::Parser;
use zenoh::{Config, Wait};
use zenoh::{config::Config, Wait};
use zenoh_examples::CommonArgs;

struct Stats {
Expand Down
2 changes: 1 addition & 1 deletion examples/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Check ../README.md for usage.
//!

use zenoh::{config::WhatAmI, Config};
use zenoh::config::{Config, WhatAmI};

#[derive(clap::ValueEnum, Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub enum Wai {
Expand Down
3 changes: 2 additions & 1 deletion plugins/zenoh-plugin-storage-manager/tests/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ use std::{str::FromStr, thread::sleep};

use tokio::runtime::Runtime;
use zenoh::{
internal::zasync_executor_init, query::Reply, sample::Sample, time::Timestamp, Config, Session,
config::Config, internal::zasync_executor_init, query::Reply, sample::Sample, time::Timestamp,
Session,
};
use zenoh_plugin_trait::Plugin;

Expand Down
3 changes: 2 additions & 1 deletion plugins/zenoh-plugin-storage-manager/tests/wildcard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ use std::{str::FromStr, thread::sleep};
// use std::collections::HashMap;
use tokio::runtime::Runtime;
use zenoh::{
internal::zasync_executor_init, query::Reply, sample::Sample, time::Timestamp, Config, Session,
config::Config, internal::zasync_executor_init, query::Reply, sample::Sample, time::Timestamp,
Session,
};
use zenoh_plugin_trait::Plugin;

Expand Down
2 changes: 1 addition & 1 deletion zenoh-ext/examples/examples/z_member.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use std::{sync::Arc, time::Duration};

use futures::StreamExt;
use zenoh::Config;
use zenoh::config::Config;
use zenoh_ext::group::*;

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion zenoh-ext/examples/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! See the code in ../examples/
//! Check ../README.md for usage.
//!
use zenoh::{config::WhatAmI, Config};
use zenoh::config::{Config, WhatAmI};

#[derive(clap::ValueEnum, Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub enum Wai {
Expand Down
24 changes: 12 additions & 12 deletions zenoh-ext/tests/liveliness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async fn test_liveliness_querying_subscriber_clique() {
zenoh_util::init_log_from_env_or("error");

let peer1 = {
let mut c = zenoh::Config::default();
let mut c = zenoh::config::default();
c.listen
.endpoints
.set(vec![PEER1_ENDPOINT.parse::<EndPoint>().unwrap()])
Expand All @@ -49,7 +49,7 @@ async fn test_liveliness_querying_subscriber_clique() {
};

let peer2 = {
let mut c = zenoh::Config::default();
let mut c = zenoh::config::default();
c.connect
.endpoints
.set(vec![PEER1_ENDPOINT.parse::<EndPoint>().unwrap()])
Expand Down Expand Up @@ -114,7 +114,7 @@ async fn test_liveliness_querying_subscriber_brokered() {
zenoh_util::init_log_from_env_or("error");

let router = {
let mut c = zenoh::Config::default();
let mut c = zenoh::config::default();
c.listen
.endpoints
.set(vec![ROUTER_ENDPOINT.parse::<EndPoint>().unwrap()])
Expand All @@ -127,7 +127,7 @@ async fn test_liveliness_querying_subscriber_brokered() {
};

let client1 = {
let mut c = zenoh::Config::default();
let mut c = zenoh::config::default();
c.connect
.endpoints
.set(vec![ROUTER_ENDPOINT.parse::<EndPoint>().unwrap()])
Expand All @@ -140,7 +140,7 @@ async fn test_liveliness_querying_subscriber_brokered() {
};

let client2 = {
let mut c = zenoh::Config::default();
let mut c = zenoh::config::default();
c.connect
.endpoints
.set(vec![ROUTER_ENDPOINT.parse::<EndPoint>().unwrap()])
Expand All @@ -153,7 +153,7 @@ async fn test_liveliness_querying_subscriber_brokered() {
};

let client3 = {
let mut c = zenoh::Config::default();
let mut c = zenoh::config::default();
c.connect
.endpoints
.set(vec![ROUTER_ENDPOINT.parse::<EndPoint>().unwrap()])
Expand Down Expand Up @@ -220,7 +220,7 @@ async fn test_liveliness_fetching_subscriber_clique() {
zenoh_util::init_log_from_env_or("error");

let peer1 = {
let mut c = zenoh::Config::default();
let mut c = zenoh::config::default();
c.listen
.endpoints
.set(vec![PEER1_ENDPOINT.parse::<EndPoint>().unwrap()])
Expand All @@ -233,7 +233,7 @@ async fn test_liveliness_fetching_subscriber_clique() {
};

let peer2 = {
let mut c = zenoh::Config::default();
let mut c = zenoh::config::default();
c.connect
.endpoints
.set(vec![PEER1_ENDPOINT.parse::<EndPoint>().unwrap()])
Expand Down Expand Up @@ -302,7 +302,7 @@ async fn test_liveliness_fetching_subscriber_brokered() {
zenoh_util::init_log_from_env_or("error");

let router = {
let mut c = zenoh::Config::default();
let mut c = zenoh::config::default();
c.listen
.endpoints
.set(vec![ROUTER_ENDPOINT.parse::<EndPoint>().unwrap()])
Expand All @@ -315,7 +315,7 @@ async fn test_liveliness_fetching_subscriber_brokered() {
};

let client1 = {
let mut c = zenoh::Config::default();
let mut c = zenoh::config::default();
c.connect
.endpoints
.set(vec![ROUTER_ENDPOINT.parse::<EndPoint>().unwrap()])
Expand All @@ -328,7 +328,7 @@ async fn test_liveliness_fetching_subscriber_brokered() {
};

let client2 = {
let mut c = zenoh::Config::default();
let mut c = zenoh::config::default();
c.connect
.endpoints
.set(vec![ROUTER_ENDPOINT.parse::<EndPoint>().unwrap()])
Expand All @@ -341,7 +341,7 @@ async fn test_liveliness_fetching_subscriber_brokered() {
};

let client3 = {
let mut c = zenoh::Config::default();
let mut c = zenoh::config::default();
c.connect
.endpoints
.set(vec![ROUTER_ENDPOINT.parse::<EndPoint>().unwrap()])
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/api/publisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ impl<Handler> IntoFuture for MatchingListenerUndeclaration<Handler> {

#[cfg(test)]
mod tests {
use crate::{sample::SampleKind, Config, Wait};
use crate::{config::Config, sample::SampleKind, Wait};

#[cfg(feature = "internal")]
#[test]
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/api/scouting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ use zenoh_task::TerminatableTask;

use crate::{
api::handlers::{locked, Callback, DefaultHandler, IntoHandler},
config::Config,
net::runtime::{orchestrator::Loop, Runtime},
Config,
};

/// A builder for initializing a [`Scout`].
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/api/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ use super::{
#[cfg(feature = "unstable")]
use crate::api::selector::ZenohParameters;
use crate::{
config::Config,
net::{
primitives::Primitives,
routing::dispatcher::face::Face,
runtime::{Runtime, RuntimeBuilder},
},
Config,
};

zconfigurable! {
Expand Down
1 change: 0 additions & 1 deletion zenoh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ pub use zenoh_util::{init_log_from_env_or, try_init_log_from_env};

#[doc(inline)]
pub use crate::{
config::Config,
scouting::scout,
session::{open, Session},
};
Expand Down
10 changes: 7 additions & 3 deletions zenoh/tests/acl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ mod test {
};

use tokio::runtime::Handle;
use zenoh::{config::WhatAmI, sample::SampleKind, Config, Session};
use zenoh::{
config::{Config, WhatAmI},
sample::SampleKind,
Session,
};
use zenoh_config::{EndPoint, ModeDependentValue};
use zenoh_core::{zlock, ztimeout};

Expand Down Expand Up @@ -75,7 +79,7 @@ mod test {

async fn get_client_sessions(port: u16) -> (Session, Session) {
println!("Opening client sessions");
let mut config = zenoh::Config::default();
let mut config = zenoh::config::default();
config.set_mode(Some(WhatAmI::Client)).unwrap();
config
.connect
Expand All @@ -88,7 +92,7 @@ mod test {

let s01 = ztimeout!(zenoh::open(config)).unwrap();

let mut config = zenoh::Config::default();
let mut config = zenoh::config::default();
config.set_mode(Some(WhatAmI::Client)).unwrap();
config
.connect
Expand Down
Loading

0 comments on commit 07844f5

Please sign in to comment.