Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Router reorg #587

Merged
merged 52 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
66f41d8
Code move
OlivierHecart Oct 12, 2023
ec960ea
Code move
OlivierHecart Nov 2, 2023
939daa4
Use RoutingContext type
OlivierHecart Nov 2, 2023
6e1c124
Structs split
OlivierHecart Nov 7, 2023
239d8cb
Renaming
OlivierHecart Nov 7, 2023
b0f999b
Visibility
OlivierHecart Nov 7, 2023
2a5466b
Move ingress/egress filters out of pubsub
OlivierHecart Nov 13, 2023
0f2fa24
Make hat abstract
OlivierHecart Nov 15, 2023
002db77
Abstract missing close_face fn
OlivierHecart Nov 15, 2023
a33fcf1
Duplicate hat
OlivierHecart Nov 15, 2023
6b61780
Move Primitives
OlivierHecart Nov 16, 2023
0a76ae3
Move link_id into HatFace
OlivierHecart Nov 22, 2023
ef541d8
Change face initialization
OlivierHecart Nov 22, 2023
1755ba9
Interceptors
OlivierHecart Nov 22, 2023
cb693dc
Interceptor types renaming
OlivierHecart Nov 23, 2023
c520168
Rename RoutingContext
OlivierHecart Nov 23, 2023
a4a672e
Add RoutingContext and LoggerInterceptor
OlivierHecart Dec 1, 2023
59e8de7
Interceptors can access the Config at construction
OlivierHecart Dec 5, 2023
9c94df5
Split linkstate and p2p peer hats
OlivierHecart Dec 5, 2023
0096e59
Simplify HatTrait init function
OlivierHecart Dec 7, 2023
d4fac3d
Hats cleanup
OlivierHecart Dec 11, 2023
7c8732c
Reintroduce routes precomputation
OlivierHecart Dec 22, 2023
b2a7ee2
Improve routes precomputation
OlivierHecart Dec 22, 2023
43fcb78
Reintroduce matching pulls precomputation
OlivierHecart Dec 22, 2023
7cd513a
Perf improvements
OlivierHecart Jan 5, 2024
b530da2
Perf improvements
OlivierHecart Jan 5, 2024
05e9c3b
Merge branch 'master' into router-reorg
OlivierHecart Jan 9, 2024
d5fcdfa
Remove files wrongly reintroduced by merge
OlivierHecart Jan 9, 2024
331cb3f
Fix complete_n build
OlivierHecart Jan 9, 2024
458e64c
Remove useless checks
OlivierHecart Jan 9, 2024
b69ae82
Fix OAM handling
OlivierHecart Jan 10, 2024
60f0ed0
Remove commented code
OlivierHecart Jan 10, 2024
27e1974
Simplified routes computation hats api
OlivierHecart Jan 11, 2024
7cdfc44
Move matching pulls computation out of hats
OlivierHecart Jan 11, 2024
567feb9
Fix query routes update
OlivierHecart Jan 11, 2024
57a5d8f
Fix copy-paste error
OlivierHecart Jan 12, 2024
62049b1
Renaming
OlivierHecart Jan 15, 2024
a1301d5
Add missing query routes deactivations
OlivierHecart Jan 17, 2024
6d9f2f6
Refactor code
OlivierHecart Jan 17, 2024
7af8480
Improve perfromances
OlivierHecart Jan 18, 2024
2ddfd45
Merge branch 'main' into router-reorg
OlivierHecart Jan 29, 2024
0a804d0
Remove unnecessary clippy alllows
OlivierHecart Jan 29, 2024
d7ed043
Code format
OlivierHecart Jan 29, 2024
5e73775
Rename TREES_COMPUTATION_DELAY constant
OlivierHecart Jan 29, 2024
1570b3d
Address review comment
OlivierHecart Jan 29, 2024
a2837c1
Reexpose subsribers and queryables in adminspace
OlivierHecart Jan 30, 2024
62bf809
Reexpose linkstate graphs in adminspace
OlivierHecart Jan 30, 2024
9f3c6be
Fix bug propagating subscriptions
OlivierHecart Jan 30, 2024
9ed4459
Reintroduce tables tests
OlivierHecart Jan 30, 2024
e76afa7
Remove unneeded clippy allows
OlivierHecart Jan 30, 2024
3696080
Improve TODO comments
OlivierHecart Jan 31, 2024
5be7c26
Improve TODO comments
OlivierHecart Jan 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move Primitives
  • Loading branch information
OlivierHecart committed Nov 16, 2023
commit 6b61780d1432b9dfb89b5f8bca311abca282fe6f
2 changes: 0 additions & 2 deletions io/zenoh-transport/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
mod common;
mod manager;
mod multicast;
mod primitives;
pub mod unicast;

#[cfg(feature = "stats")]
Expand All @@ -31,7 +30,6 @@ mod shm;

pub use manager::*;
pub use multicast::*;
pub use primitives::*;
use serde::Serialize;
use std::any::Any;
use std::sync::Arc;
Expand Down
3 changes: 1 addition & 2 deletions zenoh/src/key_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ use zenoh_protocol::{
network::{declare, DeclareBody, Mapping, UndeclareKeyExpr},
};
use zenoh_result::ZResult;
use zenoh_transport::Primitives;

use crate::{prelude::Selector, Session, Undeclarable};
use crate::{net::primitives::Primitives, prelude::Selector, Session, Undeclarable};

#[derive(Clone, Debug)]
pub(crate) enum KeyExprInner<'a> {
Expand Down
4 changes: 2 additions & 2 deletions zenoh/src/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
#[doc(hidden)]
pub(crate) mod codec;
#[doc(hidden)]
pub(crate) mod primitives;
#[doc(hidden)]
pub(crate) mod protocol;
#[doc(hidden)]
pub(crate) mod routing;
#[doc(hidden)]
pub mod runtime;
#[doc(hidden)]
pub(crate) use zenoh_transport as transport;

#[cfg(test)]
pub(crate) mod tests;
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// ZettaScale Zenoh Team, <zenoh@zettascale.tech>
//
use super::Primitives;
use crate::TransportPeerEventHandler;
use std::any::Any;
use zenoh_link::Link;
use zenoh_protocol::network::{NetworkBody, NetworkMessage};
use zenoh_result::ZResult;
use zenoh_transport::TransportPeerEventHandler;

pub struct DeMux<P: Primitives> {
primitives: P,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ pub trait Primitives: Send + Sync {
#[derive(Default)]
pub struct DummyPrimitives;

impl DummyPrimitives {
pub fn new() -> Self {
Self
}
}

impl Primitives for DummyPrimitives {
fn send_declare(&self, _msg: Declare) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
// Contributors:
// ZettaScale Zenoh Team, <zenoh@zettascale.tech>
//
use super::super::{TransportMulticast, TransportUnicast};
use super::Primitives;
use zenoh_protocol::network::{
Declare, NetworkBody, NetworkMessage, Push, Request, Response, ResponseFinal,
};
use zenoh_transport::{TransportMulticast, TransportUnicast};

pub struct Mux {
handler: TransportUnicast,
Expand Down
4 changes: 3 additions & 1 deletion zenoh/src/net/routing/dispatcher/face.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use crate::net::primitives::Primitives;

//
// Copyright (c) 2023 ZettaScale Technology
//
Expand Down Expand Up @@ -25,7 +27,7 @@ use zenoh_protocol::{
};
#[cfg(feature = "stats")]
use zenoh_transport::stats::TransportStats;
use zenoh_transport::{Primitives, TransportMulticast};
use zenoh_transport::TransportMulticast;

pub struct FaceState {
pub(crate) id: usize,
Expand Down
41 changes: 19 additions & 22 deletions zenoh/src/net/routing/hat/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,25 @@
//!
//! [Click here for Zenoh's documentation](../zenoh/index.html)
use self::{
network::{Network, shared_nodes},
pubsub::{pubsub_linkstate_change, pubsub_new_face, pubsub_remove_node, undeclare_client_subscription},
queries::{queries_linkstate_change, queries_new_face, queries_remove_node, undeclare_client_queryable},
network::{shared_nodes, Network},
pubsub::{
pubsub_linkstate_change, pubsub_new_face, pubsub_remove_node, undeclare_client_subscription,
},
queries::{
queries_linkstate_change, queries_new_face, queries_remove_node, undeclare_client_queryable,
},
};
use super::{super::dispatcher::{
face::FaceState,
tables::{
Resource, RoutingContext,
RoutingExpr, Tables, TablesLock,
use super::{
super::dispatcher::{
face::FaceState,
tables::{Resource, RoutingContext, RoutingExpr, Tables, TablesLock},
},
}, HatBaseTrait, HatTrait};
HatBaseTrait, HatTrait,
};
use crate::{
net::{
codec::Zenoh080Routing,
primitives::{Mux, Primitives},
protocol::linkstate::LinkStateList,
},
runtime::Runtime,
Expand All @@ -46,15 +51,11 @@ use std::{
use zenoh_config::{WhatAmI, WhatAmIMatcher, ZenohId};
use zenoh_protocol::{
common::ZExtBody,
network::{
declare::queryable::ext::QueryableInfo,
oam::id::OAM_LINKSTATE,
Oam,
},
network::{declare::queryable::ext::QueryableInfo, oam::id::OAM_LINKSTATE, Oam},
};
use zenoh_result::ZResult;
use zenoh_sync::get_mut_unchecked;
use zenoh_transport::{Mux, Primitives, TransportUnicast};
use zenoh_transport::TransportUnicast;

mod network;
mod pubsub;
Expand All @@ -64,8 +65,6 @@ zconfigurable! {
static ref TREES_COMPUTATION_DELAY: u64 = 100;
OlivierHecart marked this conversation as resolved.
Show resolved Hide resolved
}



macro_rules! hat {
($t:expr) => {
$t.hat.downcast_ref::<HatTables>().unwrap()
Expand Down Expand Up @@ -112,8 +111,6 @@ macro_rules! face_hat_mut {
}
use face_hat_mut;



struct HatTables {
router_subs: HashSet<Arc<Resource>>,
peer_subs: HashSet<Arc<Resource>>,
Expand Down Expand Up @@ -322,11 +319,11 @@ impl HatBaseTrait for HatCode {
fn new_tables(&self, router_peers_failover_brokering: bool) -> Box<dyn Any + Send + Sync> {
Box::new(HatTables::new(router_peers_failover_brokering))
}

fn new_face(&self) -> Box<dyn Any + Send + Sync> {
Box::new(HatFace::new())
}

fn new_resource(&self) -> Box<dyn Any + Send + Sync> {
Box::new(HatContext::new())
}
Expand Down Expand Up @@ -882,4 +879,4 @@ fn get_peer(tables: &Tables, face: &Arc<FaceState>, nodeid: RoutingContext) -> O
}
}

impl HatTrait for HatCode {}
impl HatTrait for HatCode {}
10 changes: 5 additions & 5 deletions zenoh/src/net/routing/hat/client/pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
// Contributors:
// ZettaScale Zenoh Team, <zenoh@zettascale.tech>
//
use super::network::Network;
use super::{face_hat, face_hat_mut, hat, hat_mut, res_hat, res_hat_mut};
use super::{get_peer, get_router, HatCode, HatContext, HatFace, HatTables};
use crate::net::routing::dispatcher::face::FaceState;
use crate::net::routing::dispatcher::pubsub::*;
use crate::net::routing::dispatcher::resource::{Resource, RoutingContext, SessionContext};
use crate::net::routing::dispatcher::tables::{DataRoutes, PullCaches, Route, RoutingExpr};
use crate::net::routing::dispatcher::tables::{Tables, TablesLock};
use crate::net::routing::PREFIX_LIVELINESS;
use crate::net::routing::hat::HatPubSubTrait;
use super::network::Network;
use super::{get_peer, get_router, HatCode, HatContext, HatFace, HatTables};
use crate::net::routing::dispatcher::tables::{DataRoutes, PullCaches, Route, RoutingExpr};
use super::{face_hat, face_hat_mut, hat, hat_mut, res_hat, res_hat_mut};
use crate::net::routing::PREFIX_LIVELINESS;
use petgraph::graph::NodeIndex;
use std::borrow::Cow;
use std::collections::{HashMap, HashSet};
Expand Down
10 changes: 5 additions & 5 deletions zenoh/src/net/routing/hat/client/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
// Contributors:
// ZettaScale Zenoh Team, <zenoh@zettascale.tech>
//
use super::network::Network;
use super::{face_hat, face_hat_mut, hat, hat_mut, res_hat, res_hat_mut};
use super::{get_peer, get_router, HatCode, HatContext, HatFace, HatTables};
use crate::net::routing::dispatcher::face::FaceState;
use crate::net::routing::dispatcher::queries::*;
use crate::net::routing::dispatcher::resource::{Resource, RoutingContext, SessionContext};
use crate::net::routing::dispatcher::tables::{Tables, TablesLock};
use crate::net::routing::hat::HatQueriesTrait;
use super::network::Network;
use super::{get_peer, get_router, HatCode, HatContext, HatFace, HatTables};
use crate::net::routing::dispatcher::tables::{
QueryRoutes, QueryTargetQabl, QueryTargetQablSet, RoutingExpr,
};
use crate::net::routing::dispatcher::tables::{Tables, TablesLock};
use crate::net::routing::hat::HatQueriesTrait;
use crate::net::routing::PREFIX_LIVELINESS;
use super::{face_hat, face_hat_mut, hat, hat_mut, res_hat, res_hat_mut};
use ordered_float::OrderedFloat;
use petgraph::graph::NodeIndex;
use std::borrow::Cow;
Expand Down
11 changes: 4 additions & 7 deletions zenoh/src/net/routing/hat/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ use super::dispatcher::{
RoutingExpr, Tables, TablesLock,
},
};
use crate::runtime::Runtime;
use std::{
any::Any,
sync::Arc,
};
use crate::{net::primitives::Primitives, runtime::Runtime};
use std::{any::Any, sync::Arc};
use zenoh_buffers::ZBuf;
use zenoh_config::{WhatAmI, WhatAmIMatcher};
use zenoh_protocol::{
Expand All @@ -39,7 +36,7 @@ use zenoh_protocol::{
},
};
use zenoh_result::ZResult;
use zenoh_transport::{Primitives, TransportUnicast};
use zenoh_transport::TransportUnicast;

mod client;
mod peer;
Expand Down Expand Up @@ -194,4 +191,4 @@ pub(crate) fn new_hat(whatami: WhatAmI) -> Box<dyn HatTrait + Send + Sync> {
WhatAmI::Peer => Box::new(peer::HatCode {}),
WhatAmI::Router => Box::new(router::HatCode {}),
}
}
}
41 changes: 19 additions & 22 deletions zenoh/src/net/routing/hat/peer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,25 @@
//!
//! [Click here for Zenoh's documentation](../zenoh/index.html)
use self::{
network::{Network, shared_nodes},
pubsub::{pubsub_linkstate_change, pubsub_new_face, pubsub_remove_node, undeclare_client_subscription},
queries::{queries_linkstate_change, queries_new_face, queries_remove_node, undeclare_client_queryable},
network::{shared_nodes, Network},
pubsub::{
pubsub_linkstate_change, pubsub_new_face, pubsub_remove_node, undeclare_client_subscription,
},
queries::{
queries_linkstate_change, queries_new_face, queries_remove_node, undeclare_client_queryable,
},
};
use super::{super::dispatcher::{
face::FaceState,
tables::{
Resource, RoutingContext,
RoutingExpr, Tables, TablesLock,
use super::{
super::dispatcher::{
face::FaceState,
tables::{Resource, RoutingContext, RoutingExpr, Tables, TablesLock},
},
}, HatBaseTrait, HatTrait};
HatBaseTrait, HatTrait,
};
use crate::{
net::{
codec::Zenoh080Routing,
primitives::{Mux, Primitives},
protocol::linkstate::LinkStateList,
},
runtime::Runtime,
Expand All @@ -46,15 +51,11 @@ use std::{
use zenoh_config::{WhatAmI, WhatAmIMatcher, ZenohId};
use zenoh_protocol::{
common::ZExtBody,
network::{
declare::queryable::ext::QueryableInfo,
oam::id::OAM_LINKSTATE,
Oam,
},
network::{declare::queryable::ext::QueryableInfo, oam::id::OAM_LINKSTATE, Oam},
};
use zenoh_result::ZResult;
use zenoh_sync::get_mut_unchecked;
use zenoh_transport::{Mux, Primitives, TransportUnicast};
use zenoh_transport::TransportUnicast;

mod network;
mod pubsub;
Expand All @@ -64,8 +65,6 @@ zconfigurable! {
static ref TREES_COMPUTATION_DELAY: u64 = 100;
}



macro_rules! hat {
($t:expr) => {
$t.hat.downcast_ref::<HatTables>().unwrap()
Expand Down Expand Up @@ -112,8 +111,6 @@ macro_rules! face_hat_mut {
}
use face_hat_mut;



struct HatTables {
router_subs: HashSet<Arc<Resource>>,
peer_subs: HashSet<Arc<Resource>>,
Expand Down Expand Up @@ -322,11 +319,11 @@ impl HatBaseTrait for HatCode {
fn new_tables(&self, router_peers_failover_brokering: bool) -> Box<dyn Any + Send + Sync> {
Box::new(HatTables::new(router_peers_failover_brokering))
}

fn new_face(&self) -> Box<dyn Any + Send + Sync> {
Box::new(HatFace::new())
}

fn new_resource(&self) -> Box<dyn Any + Send + Sync> {
Box::new(HatContext::new())
}
Expand Down Expand Up @@ -882,4 +879,4 @@ fn get_peer(tables: &Tables, face: &Arc<FaceState>, nodeid: RoutingContext) -> O
}
}

impl HatTrait for HatCode {}
impl HatTrait for HatCode {}
10 changes: 5 additions & 5 deletions zenoh/src/net/routing/hat/peer/pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
// Contributors:
// ZettaScale Zenoh Team, <zenoh@zettascale.tech>
//
use super::network::Network;
use super::{face_hat, face_hat_mut, hat, hat_mut, res_hat, res_hat_mut};
use super::{get_peer, get_router, HatCode, HatContext, HatFace, HatTables};
use crate::net::routing::dispatcher::face::FaceState;
use crate::net::routing::dispatcher::pubsub::*;
use crate::net::routing::dispatcher::resource::{Resource, RoutingContext, SessionContext};
use crate::net::routing::dispatcher::tables::{DataRoutes, PullCaches, Route, RoutingExpr};
use crate::net::routing::dispatcher::tables::{Tables, TablesLock};
use crate::net::routing::PREFIX_LIVELINESS;
use crate::net::routing::hat::HatPubSubTrait;
use super::network::Network;
use super::{get_peer, get_router, HatCode, HatContext, HatFace, HatTables};
use crate::net::routing::dispatcher::tables::{DataRoutes, PullCaches, Route, RoutingExpr};
use super::{face_hat, face_hat_mut, hat, hat_mut, res_hat, res_hat_mut};
use crate::net::routing::PREFIX_LIVELINESS;
use petgraph::graph::NodeIndex;
use std::borrow::Cow;
use std::collections::{HashMap, HashSet};
Expand Down
Loading