Skip to content

Commit

Permalink
more tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin committed Feb 5, 2024
1 parent 3eaa780 commit c5ad4d7
Show file tree
Hide file tree
Showing 17 changed files with 158 additions and 24 deletions.
2 changes: 2 additions & 0 deletions commons/zenoh-protocol/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub struct Property {
}

/// The kind of a `Sample`.
// tags{sample.kind}
#[repr(u8)]
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
pub enum SampleKind {
Expand Down Expand Up @@ -424,6 +425,7 @@ pub enum ConsolidationMode {
}

/// The `zenoh::queryable::Queryable`s that should be target of a `zenoh::Session::get()`.
// tags{session.query.target}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub enum QueryTarget {
#[default]
Expand Down
1 change: 1 addition & 0 deletions zenoh/src/net/codec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//
// ignore_tagging
pub(crate) mod linkstate;

// ignore_tagging
Expand Down
1 change: 1 addition & 0 deletions zenoh/src/net/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//
// ignore_tagging
pub(crate) mod linkstate;
2 changes: 2 additions & 0 deletions zenoh/src/net/routing/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//
use super::pubsub::*;
use super::queries::*;
use super::router::*;
use std::collections::{HashMap, HashSet};
use std::fmt;
Expand Down
14 changes: 8 additions & 6 deletions zenoh/src/net/routing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
//! This module is intended for Zenoh's internal use.
//!
//! [Click here for Zenoh's documentation](../zenoh/index.html)
pub mod face;
pub mod network;
pub mod pubsub;
pub mod queries;
pub mod resource;
pub mod router;
pub(crate) mod face;
pub(crate) mod network;
pub(crate) mod pubsub;
pub(crate) mod queries;
// ignore_tagging
pub(crate) mod resource;
// ignore_tagging
pub(crate) mod router;

use super::runtime;

Expand Down
14 changes: 7 additions & 7 deletions zenoh/src/net/routing/pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ fn register_router_subscription(
propagate_simple_subscription(tables, res, sub_info, face);
}

pub fn declare_router_subscription(
pub(crate) fn declare_router_subscription(
tables: &TablesLock,
rtables: RwLockReadGuard<Tables>,
face: &mut Arc<FaceState>,
Expand Down Expand Up @@ -404,7 +404,7 @@ fn register_client_subscription(
get_mut_unchecked(face).remote_subs.insert(res.clone());
}

pub fn declare_client_subscription(
pub(crate) fn declare_client_subscription(
tables: &TablesLock,
rtables: RwLockReadGuard<Tables>,
face: &mut Arc<FaceState>,
Expand Down Expand Up @@ -717,7 +717,7 @@ fn undeclare_router_subscription(
}
}

pub fn forget_router_subscription(
pub(crate) fn forget_router_subscription(
tables: &TablesLock,
rtables: RwLockReadGuard<Tables>,
face: &mut Arc<FaceState>,
Expand Down Expand Up @@ -783,7 +783,7 @@ fn undeclare_peer_subscription(
}
}

pub fn forget_peer_subscription(
pub(crate) fn forget_peer_subscription(
tables: &TablesLock,
rtables: RwLockReadGuard<Tables>,
face: &mut Arc<FaceState>,
Expand Down Expand Up @@ -884,7 +884,7 @@ pub(crate) fn undeclare_client_subscription(
}
}

pub fn forget_client_subscription(
pub(crate) fn forget_client_subscription(
tables: &TablesLock,
rtables: RwLockReadGuard<Tables>,
face: &mut Arc<FaceState>,
Expand Down Expand Up @@ -1750,7 +1750,7 @@ macro_rules! inc_stats {
}

#[allow(clippy::too_many_arguments)]
pub fn full_reentrant_route_data(
pub(crate) fn full_reentrant_route_data(
tables_ref: &RwLock<Tables>,
face: &FaceState,
expr: &WireExpr,
Expand Down Expand Up @@ -1894,7 +1894,7 @@ pub fn full_reentrant_route_data(
}
}

pub fn pull_data(tables_ref: &RwLock<Tables>, face: &Arc<FaceState>, expr: WireExpr) {
pub(crate) fn pull_data(tables_ref: &RwLock<Tables>, face: &Arc<FaceState>, expr: WireExpr) {
let tables = zread!(tables_ref);
match tables.get_mapping(face, &expr.scope, expr.mapping) {
Some(prefix) => match Resource::get_resource(prefix, expr.suffix.as_ref()) {
Expand Down
14 changes: 7 additions & 7 deletions zenoh/src/net/routing/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ fn register_router_queryable(
propagate_simple_queryable(tables, res, face);
}

pub fn declare_router_queryable(
pub(crate) fn declare_router_queryable(
tables: &TablesLock,
rtables: RwLockReadGuard<Tables>,
face: &mut Arc<FaceState>,
Expand Down Expand Up @@ -473,7 +473,7 @@ fn register_peer_queryable(
}
}

pub fn declare_peer_queryable(
pub(crate) fn declare_peer_queryable(
tables: &TablesLock,
rtables: RwLockReadGuard<Tables>,
face: &mut Arc<FaceState>,
Expand Down Expand Up @@ -558,7 +558,7 @@ fn register_client_queryable(
get_mut_unchecked(face).remote_qabls.insert(res.clone());
}

pub fn declare_client_queryable(
pub(crate) fn declare_client_queryable(
tables: &TablesLock,
rtables: RwLockReadGuard<Tables>,
face: &mut Arc<FaceState>,
Expand Down Expand Up @@ -843,7 +843,7 @@ fn undeclare_router_queryable(
}
}

pub fn forget_router_queryable(
pub(crate) fn forget_router_queryable(
tables: &TablesLock,
rtables: RwLockReadGuard<Tables>,
face: &mut Arc<FaceState>,
Expand Down Expand Up @@ -903,7 +903,7 @@ fn undeclare_peer_queryable(
}
}

pub fn forget_peer_queryable(
pub(crate) fn forget_peer_queryable(
tables: &TablesLock,
rtables: RwLockReadGuard<Tables>,
face: &mut Arc<FaceState>,
Expand Down Expand Up @@ -1018,7 +1018,7 @@ pub(crate) fn undeclare_client_queryable(
}
}

pub fn forget_client_queryable(
pub(crate) fn forget_client_queryable(
tables: &TablesLock,
rtables: RwLockReadGuard<Tables>,
face: &mut Arc<FaceState>,
Expand Down Expand Up @@ -2060,7 +2060,7 @@ macro_rules! inc_res_stats {
}

#[allow(clippy::too_many_arguments)]
pub fn route_query(
pub(crate) fn route_query(
tables_ref: &Arc<TablesLock>,
face: &Arc<FaceState>,
expr: &WireExpr,
Expand Down
1 change: 0 additions & 1 deletion zenoh/src/net/routing/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ impl<'a> RoutingExpr<'a> {
}
}

// ignore_tagging
pub struct Tables {
pub(crate) zid: ZenohId,
pub(crate) whatami: WhatAmI,
Expand Down
16 changes: 15 additions & 1 deletion zenoh/src/net/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
//! This module is intended for Zenoh's internal use.
//!
//! [Click here for Zenoh's documentation](../zenoh/index.html)
// ignore_tagging
mod adminspace;
pub mod orchestrator;
// ignore_tagging
pub(crate) mod orchestrator;

use super::routing;
use super::routing::face::Face;
Expand Down Expand Up @@ -61,6 +64,7 @@ struct RuntimeState {
stop_source: std::sync::RwLock<Option<StopSource>>,
}

// ignore_tagging
#[derive(Clone)]
pub struct Runtime {
state: Arc<RuntimeState>,
Expand All @@ -78,6 +82,7 @@ impl StructVersion for Runtime {
impl PluginStartArgs for Runtime {}

impl Runtime {
// ignore_tagging
pub async fn new(config: Config) -> ZResult<Runtime> {
let mut runtime = Runtime::init(config).await?;
match runtime.start().await {
Expand Down Expand Up @@ -182,25 +187,30 @@ impl Runtime {
}

#[inline(always)]
// ignore_tagging
pub fn manager(&self) -> &TransportManager {
&self.state.manager
}

// ignore_tagging
pub fn new_handler(&self, handler: Arc<dyn TransportEventHandler>) {
zwrite!(self.state.transport_handlers).push(handler);
}

// ignore_tagging
pub async fn close(&self) -> ZResult<()> {
log::trace!("Runtime::close())");
drop(self.state.stop_source.write().unwrap().take());
self.manager().close().await;
Ok(())
}

// ignore_tagging
pub fn new_timestamp(&self) -> Option<uhlc::Timestamp> {
self.state.hlc.as_ref().map(|hlc| hlc.new_timestamp())
}

// ignore_tagging
pub fn get_locators(&self) -> Vec<Locator> {
self.state.locators.read().unwrap().clone()
}
Expand All @@ -222,18 +232,22 @@ impl Runtime {
self.state.router.clone()
}

// ignore_tagging
pub fn config(&self) -> &Notifier<Config> {
&self.state.config
}

// ignore_tagging
pub fn hlc(&self) -> Option<&HLC> {
self.state.hlc.as_ref().map(Arc::as_ref)
}

// ignore_tagging
pub fn zid(&self) -> ZenohId {
self.state.zid
}

// ignore_tagging
pub fn whatami(&self) -> WhatAmI {
self.state.whatami
}
Expand Down
1 change: 1 addition & 0 deletions zenoh/src/net/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
// ignore_tagging
pub(crate) mod tables;
1 change: 1 addition & 0 deletions zenoh/src/net/tests/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//
use crate::net::routing::pubsub::*;
use crate::net::routing::router::{self, *};
use std::convert::{TryFrom, TryInto};
use std::sync::{Arc, Mutex, RwLock};
Expand Down
1 change: 1 addition & 0 deletions zenoh/src/plugins/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//! This module is intended for Zenoh's internal use.
//!
//! [Click here for Zenoh's documentation](../../zenoh/index.html)
// ignore_tagging
pub(crate) mod sealed;

#[zenoh_macros::unstable]
Expand Down
Loading

0 comments on commit c5ad4d7

Please sign in to comment.