pub trait Store {
    fn get(&self, ip: &IpAddr) -> Option<&KnownAddress>;
    fn get_mut(&mut self, ip: &IpAddr) -> Option<&mut KnownAddress>;
    fn insert(&mut self, ip: IpAddr, ka: KnownAddress) -> bool;
    fn remove(&mut self, ip: &IpAddr) -> Option<KnownAddress>;
    fn iter(
        &'a self
    ) -> Box<dyn Iterator<Item = (&'a IpAddr, &'a KnownAddress)> + 'a, Global>; fn len(&self) -> usize; fn clear(&mut self); fn flush(&mut self) -> Result<(), Error>; fn is_empty(&self) -> bool { ... } fn seed<S>(
        &mut self,
        seeds: impl Iterator<Item = S>,
        source: Source
    ) -> Result<(), Error>
    where
        S: ToSocketAddrs
, { ... } }
Expand description

Peer store.

Used to store peer addresses and metadata.

Required Methods

Get a known peer address.

Get a known peer address mutably.

Insert a new address into the store. Returns true if the address was inserted, or false if it was already known.

Remove an address from the store.

Return an iterator over the known addresses.

Returns the number of addresses.

Clears the store of all addresses.

Flush data to permanent storage.

Provided Methods

Returns true if there are no addresses.

Seed the peer store with addresses. Fails if none of the seeds could be resolved to addresses.

Implementations on Foreign Types

Implementation of Store for [crate::collections::HashMap].

Implementation of Store for std::collections::HashMap.

Implementors