Struct ckb_network::peer_store::PeerStore
source · [−]pub struct PeerStore { /* private fields */ }Expand description
Peer store
| – choose to identify –| — choose to feeler — | – delete – | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | More than seven days |
Implementations
sourceimpl PeerStore
impl PeerStore
sourcepub fn new(addr_manager: AddrManager, ban_list: BanList) -> Self
pub fn new(addr_manager: AddrManager, ban_list: BanList) -> Self
New with address list and ban list
sourcepub fn add_connected_peer(&mut self, addr: Multiaddr, session_type: SessionType)
pub fn add_connected_peer(&mut self, addr: Multiaddr, session_type: SessionType)
this method will assume peer is connected, which implies address is “verified”.
sourcepub fn add_addr(&mut self, addr: Multiaddr) -> Result<()>
pub fn add_addr(&mut self, addr: Multiaddr) -> Result<()>
Add discovered peer address this method will assume peer and addr is untrust since we have not connected to it.
sourcepub fn add_outbound_addr(&mut self, addr: Multiaddr)
pub fn add_outbound_addr(&mut self, addr: Multiaddr)
Add outbound peer address
sourcepub fn addr_manager(&self) -> &AddrManager
pub fn addr_manager(&self) -> &AddrManager
Get address manager
sourcepub fn mut_addr_manager(&mut self) -> &mut AddrManager
pub fn mut_addr_manager(&mut self) -> &mut AddrManager
Get mut address manager
sourcepub fn report(&mut self, addr: &Multiaddr, behaviour: Behaviour) -> ReportResult
pub fn report(&mut self, addr: &Multiaddr, behaviour: Behaviour) -> ReportResult
Report peer behaviours
sourcepub fn remove_disconnected_peer(&mut self, addr: &Multiaddr) -> Option<PeerInfo>
pub fn remove_disconnected_peer(&mut self, addr: &Multiaddr) -> Option<PeerInfo>
Remove peer id
sourcepub fn peer_status(&self, peer_id: &PeerId) -> Status
pub fn peer_status(&self, peer_id: &PeerId) -> Status
Get peer status
sourcepub fn fetch_addrs_to_attempt(&mut self, count: usize) -> Vec<AddrInfo>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn fetch_addrs_to_attempt(&mut self, count: usize) -> Vec<AddrInfo>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Get peers for outbound connection, this method randomly return recently connected peer addrs
sourcepub fn fetch_addrs_to_feeler(&mut self, count: usize) -> Vec<AddrInfo>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn fetch_addrs_to_feeler(&mut self, count: usize) -> Vec<AddrInfo>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Get peers for feeler connection, this method randomly return peer addrs that we never connected to.
sourcepub fn fetch_random_addrs(&mut self, count: usize) -> Vec<AddrInfo>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn fetch_random_addrs(&mut self, count: usize) -> Vec<AddrInfo>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Return valid addrs that success connected, used for discovery.
sourcepub fn is_addr_banned(&self, addr: &Multiaddr) -> bool
pub fn is_addr_banned(&self, addr: &Multiaddr) -> bool
Whether the address is banned
sourcepub fn mut_ban_list(&mut self) -> &mut BanList
pub fn mut_ban_list(&mut self) -> &mut BanList
Get mut ban list
sourcepub fn clear_ban_list(&mut self)
pub fn clear_ban_list(&mut self)
Clear ban list
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for PeerStore
impl Send for PeerStore
impl Sync for PeerStore
impl Unpin for PeerStore
impl UnwindSafe for PeerStore
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more