pub struct MeshRouter {
pub node_id: NodeId,
pub my_level: HierarchyLevel,
}Expand description
Router for mesh messages
Determines where to send messages based on the current topology.
Fields§
§node_id: NodeIdOur node ID
my_level: HierarchyLevelOur hierarchy level
Implementations§
Source§impl MeshRouter
impl MeshRouter
Sourcepub fn new(node_id: NodeId, my_level: HierarchyLevel) -> Self
pub fn new(node_id: NodeId, my_level: HierarchyLevel) -> Self
Create a new router
Sourcepub fn route(
&self,
direction: RouteDirection,
topology: &MeshTopology,
) -> RouteDecision
pub fn route( &self, direction: RouteDirection, topology: &MeshTopology, ) -> RouteDecision
Route a message based on direction
Sourcepub fn handle_received(
&self,
source: &NodeId,
destination: Option<&NodeId>,
direction: RouteDirection,
topology: &MeshTopology,
) -> RouteDecision
pub fn handle_received( &self, source: &NodeId, destination: Option<&NodeId>, direction: RouteDirection, topology: &MeshTopology, ) -> RouteDecision
Determine routing for a received message
Given the source and destination, decide what to do with a message.
Sourcepub fn aggregation_route(&self, topology: &MeshTopology) -> Option<NodeId>
pub fn aggregation_route(&self, topology: &MeshTopology) -> Option<NodeId>
Get the best route for aggregation (data flowing upward)
For HIVE-Lite nodes, this is always the parent.
Sourcepub fn dissemination_routes(&self, topology: &MeshTopology) -> Vec<NodeId>
pub fn dissemination_routes(&self, topology: &MeshTopology) -> Vec<NodeId>
Get routes for dissemination (data flowing downward)
Returns all children that should receive the data.
Trait Implementations§
Source§impl Clone for MeshRouter
impl Clone for MeshRouter
Source§fn clone(&self) -> MeshRouter
fn clone(&self) -> MeshRouter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MeshRouter
impl RefUnwindSafe for MeshRouter
impl Send for MeshRouter
impl Sync for MeshRouter
impl Unpin for MeshRouter
impl UnwindSafe for MeshRouter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more