pub struct DynamicHierarchyStrategy {
pub base_level: HierarchyLevel,
pub election_config: ElectionConfig,
pub allow_level_transitions: bool,
}Expand description
Dynamic hierarchy strategy
Dynamically assigns roles based on node capabilities and resources. Nodes with better capabilities (static, high resources, good battery) are preferred for leadership roles.
§Use Cases
- Ad-hoc disaster response networks
- Mesh network extensions
- Testing dynamic topology formation
§Example
ⓘ
let strategy = DynamicHierarchyStrategy {
base_level: HierarchyLevel::Squad,
election_config: ElectionConfig::default(),
allow_level_transitions: false,
};Fields§
§base_level: HierarchyLevelBase hierarchy level (can be elevated if no higher-level peers found)
election_config: ElectionConfigElection configuration for role determination
allow_level_transitions: boolWhether to allow automatic level transitions
Implementations§
Source§impl DynamicHierarchyStrategy
impl DynamicHierarchyStrategy
Sourcepub fn new(
base_level: HierarchyLevel,
election_config: ElectionConfig,
allow_level_transitions: bool,
) -> Self
pub fn new( base_level: HierarchyLevel, election_config: ElectionConfig, allow_level_transitions: bool, ) -> Self
Create a new dynamic hierarchy strategy
Trait Implementations§
Source§impl Clone for DynamicHierarchyStrategy
impl Clone for DynamicHierarchyStrategy
Source§fn clone(&self) -> DynamicHierarchyStrategy
fn clone(&self) -> DynamicHierarchyStrategy
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 moreSource§impl Debug for DynamicHierarchyStrategy
impl Debug for DynamicHierarchyStrategy
Source§impl HierarchyStrategy for DynamicHierarchyStrategy
impl HierarchyStrategy for DynamicHierarchyStrategy
Source§fn determine_level(&self, _node_profile: &NodeProfile) -> HierarchyLevel
fn determine_level(&self, _node_profile: &NodeProfile) -> HierarchyLevel
Determine this node’s hierarchy level Read more
Source§fn determine_role(
&self,
node_profile: &NodeProfile,
nearby_peers: &[GeographicBeacon],
) -> NodeRole
fn determine_role( &self, node_profile: &NodeProfile, nearby_peers: &[GeographicBeacon], ) -> NodeRole
Determine this node’s role within its level Read more
Source§fn can_transition(
&self,
_current_level: HierarchyLevel,
_new_level: HierarchyLevel,
) -> bool
fn can_transition( &self, _current_level: HierarchyLevel, _new_level: HierarchyLevel, ) -> bool
Check if this node can transition to a different level Read more
Auto Trait Implementations§
impl Freeze for DynamicHierarchyStrategy
impl RefUnwindSafe for DynamicHierarchyStrategy
impl Send for DynamicHierarchyStrategy
impl Sync for DynamicHierarchyStrategy
impl Unpin for DynamicHierarchyStrategy
impl UnsafeUnpin for DynamicHierarchyStrategy
impl UnwindSafe for DynamicHierarchyStrategy
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