pub struct PeerInfo {
pub node_id: NodeId,
pub role: PeerRole,
pub state: ConnectionState,
pub hierarchy_level: HierarchyLevel,
pub rssi: Option<i8>,
pub connected_at: Option<u64>,
pub messages_received: u32,
pub messages_sent: u32,
pub failure_count: u8,
pub last_seen_ms: u64,
}Expand description
Information about a peer in the mesh
Fields§
§node_id: NodeIdNode ID of the peer
role: PeerRoleRole in the topology
state: ConnectionStateConnection state
hierarchy_level: HierarchyLevelHierarchy level of the peer
rssi: Option<i8>Last known RSSI
connected_at: Option<u64>Time since connection established
messages_received: u32Number of messages received
messages_sent: u32Number of messages sent
failure_count: u8Number of connection failures
last_seen_ms: u64Last seen timestamp (monotonic ms)
Implementations§
Source§impl PeerInfo
impl PeerInfo
Sourcepub fn new(
node_id: NodeId,
role: PeerRole,
hierarchy_level: HierarchyLevel,
) -> Self
pub fn new( node_id: NodeId, role: PeerRole, hierarchy_level: HierarchyLevel, ) -> Self
Create new peer info
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if this peer is connected
Sourcepub fn update_rssi(&mut self, rssi: i8)
pub fn update_rssi(&mut self, rssi: i8)
Update RSSI value
Sourcepub fn record_failure(&mut self)
pub fn record_failure(&mut self)
Record a connection failure
Sourcepub fn reset_failures(&mut self)
pub fn reset_failures(&mut self)
Reset failure count on successful connection
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PeerInfo
impl RefUnwindSafe for PeerInfo
impl Send for PeerInfo
impl Sync for PeerInfo
impl Unpin for PeerInfo
impl UnwindSafe for PeerInfo
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