[−][src]Struct libp2prs_core::peerstore::PeerStore
Implementations
impl PeerStore[src]
pub fn save_data(&self) -> Result<()>[src]
Save addr_book when closing swarm
pub fn load_data(&self) -> Result<()>[src]
Load addr_book when initializing swarm
pub fn get_peers(&self) -> Vec<PeerId>[src]
Gets all peer Ids in peer store.
pub fn pin(&self, peer_id: &PeerId)[src]
Pins the peer Id so that GC wouldn't recycle the multiaddr of the peer.
pub fn unpin(&self, peer_id: &PeerId)[src]
Unpins the peer Id.
pub fn pinned(&self, peer_id: &PeerId) -> bool[src]
Checks if the peer is currently being pinned in peer store.
pub fn add_key(&self, peer_id: &PeerId, key: PublicKey)[src]
Adds public key by peer_id.
pub fn get_key(&self, peer_id: &PeerId) -> Option<PublicKey>[src]
Gets public key by peer_id.
pub fn add_addr(&self, peer_id: &PeerId, addr: Multiaddr, ttl: Duration)[src]
Add address to address_book by peer_id, if exists, update rtt.
pub fn add_addrs(&self, peer_id: &PeerId, addrs: Vec<Multiaddr>, ttl: Duration)[src]
Adds many new addresses if they're not already in the Address Book.
pub fn clear_addrs(&self, peer_id: &PeerId)[src]
Removes all multiaddr of a peer from peer store.
pub fn get_addrs(&self, peer_id: &PeerId) -> Option<Vec<Multiaddr>>[src]
Retrieves the all multiaddr of a peer from the peer store.
pub fn update_addr(&self, peer_id: &PeerId, new_ttl: Duration)[src]
Updates the ttl of the multiaddr of the peer.
pub fn remove_expired_addrs(&self)[src]
Removes all expired address.
pub fn add_protocols(&self, peer_id: &PeerId, protos: Vec<String>)[src]
Adds the supported protocols of a peer to the peer store.
pub fn clear_protocols(&self, peer_id: &PeerId)[src]
Clears the protocols by peer_id
pub fn get_protocols(&self, peer_id: &PeerId) -> Option<Vec<String>>[src]
Gets the protocols by peer_id.
pub fn first_supported_protocol(
&self,
peer_id: &PeerId,
protos: Vec<String>
) -> Option<String>[src]
&self,
peer_id: &PeerId,
protos: Vec<String>
) -> Option<String>
Get the first protocol which is matched by the given protocols.
pub fn support_protocols(
&self,
peer_id: &PeerId,
protos: Vec<String>
) -> Option<Vec<String>>[src]
&self,
peer_id: &PeerId,
protos: Vec<String>
) -> Option<Vec<String>>
Searches all protocols and return an option that matches by the given protocols.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for PeerStore[src]
impl Send for PeerStore[src]
impl Sync for PeerStore[src]
impl Unpin for PeerStore[src]
impl UnwindSafe for PeerStore[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,