[][src]Struct zebra_network::AddressBook

pub struct AddressBook { /* fields omitted */ }

A database of peers, their advertised services, and information on when they were last seen.

Implementations

impl AddressBook[src]

pub fn new(span: Span) -> AddressBook[src]

Construct an AddressBook with the given tracing::Span.

pub fn contains_addr(&self, addr: &SocketAddr) -> bool[src]

Returns true if the address book has an entry for addr.

pub fn get_by_addr(&self, addr: SocketAddr) -> Option<MetaAddr>[src]

Returns the entry corresponding to addr, or None if it does not exist.

pub fn update(&mut self, new: MetaAddr)[src]

Add new to the address book, updating the previous entry if new is more recent or discarding new if it is stale.

pub fn is_potentially_connected(&self, addr: &SocketAddr) -> bool[src]

Returns true if the given SocketAddr could potentially be connected to a node feeding timestamps into this address book.

pub fn peers<'a>(&'a self) -> impl Iterator<Item = MetaAddr> + 'a[src]

Return an iterator over all peers, ordered from most recently seen to least recently seen.

pub fn disconnected_peers<'a>(&'a self) -> impl Iterator<Item = MetaAddr> + 'a[src]

Return an iterator over peers known to be disconnected, ordered from most recently seen to least recently seen.

pub fn drain_newest<'a>(&'a mut self) -> impl Iterator<Item = MetaAddr> + 'a[src]

Returns an iterator that drains entries from the address book, removing them in order from most recent to least recent.

pub fn drain_oldest<'a>(&'a mut self) -> impl Iterator<Item = MetaAddr> + 'a[src]

Returns an iterator that drains entries from the address book, removing them in order from least recent to most recent.

pub fn len(&self) -> usize[src]

Returns the number of entries in this address book.

Trait Implementations

impl Debug for AddressBook[src]

impl Extend<MetaAddr> for AddressBook[src]

Auto Trait Implementations

impl !RefUnwindSafe for AddressBook

impl Send for AddressBook

impl Sync for AddressBook

impl Unpin for AddressBook

impl !UnwindSafe for AddressBook

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]