IndirectPeer

Struct IndirectPeer 

Source
pub struct IndirectPeer {
    pub node_id: NodeId,
    pub min_hops: u8,
    pub via_peers: BTreeMap<NodeId, u8>,
    pub discovered_at: u64,
    pub last_seen_ms: u64,
    pub messages_received: u32,
    pub callsign: Option<String>,
}
Expand description

Reachability information for an indirect (multi-hop) peer

Tracks peers that are not directly connected via BLE but are reachable through relay messages via intermediate nodes.

Fields§

§node_id: NodeId

The indirect peer’s node ID

§min_hops: u8

Minimum hop count to reach this peer (1-3)

§via_peers: BTreeMap<NodeId, u8>

Direct peers through which we can reach this peer Maps via_peer NodeId → hop count through that peer

§discovered_at: u64

When we first learned about this peer (ms since epoch)

§last_seen_ms: u64

Last time we received data from/about this peer (ms since epoch)

§messages_received: u32

Number of messages relayed from this peer

§callsign: Option<String>

Optional callsign if learned from documents

Implementations§

Source§

impl IndirectPeer

Source

pub fn new( node_id: NodeId, via_peer: NodeId, hop_count: u8, now_ms: u64, ) -> Self

Create a new indirect peer entry

Source

pub fn update_path( &mut self, via_peer: NodeId, hop_count: u8, now_ms: u64, ) -> bool

Update with a new path to this peer

Returns true if this is a better (shorter) path

Source

pub fn degree(&self) -> Option<PeerDegree>

Get the degree classification for this peer

Source

pub fn is_stale(&self, now_ms: u64, timeout_ms: u64) -> bool

Check if this peer is stale (not seen within timeout)

Source

pub fn paths(&self) -> Vec<(NodeId, u8)>

Get all paths to this peer as (via_peer, hop_count) pairs

Trait Implementations§

Source§

impl Clone for IndirectPeer

Source§

fn clone(&self) -> IndirectPeer

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IndirectPeer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.