[−][src]Struct snarkos_network::context::peer_book::PeerBook
Stores connected, disconnected, and known peers.
Implementations
impl PeerBook
[src]
pub fn new() -> Self
[src]
pub fn get_connected(&self) -> HashMap<SocketAddr, DateTime<Utc>>
[src]
Returns copy of connected peers.
pub fn get_gossiped(&self) -> HashMap<SocketAddr, DateTime<Utc>>
[src]
Returns copy of gossiped peers.
pub fn connected_contains(&self, address: &SocketAddr) -> bool
[src]
Returns true if address is a connected peer.
pub fn disconnected_contains(&self, address: &SocketAddr) -> bool
[src]
Returns true if address is a disconnected peer.
pub fn gossiped_contains(&self, address: &SocketAddr) -> bool
[src]
Returns true if address is a gossiped peer.
pub fn update_connected(
&mut self,
address: SocketAddr,
date: DateTime<Utc>
) -> bool
[src]
&mut self,
address: SocketAddr,
date: DateTime<Utc>
) -> bool
Move a peer from disconnected/gossiped to connected peers.
pub fn update_gossiped(
&mut self,
address: SocketAddr,
date: DateTime<Utc>
) -> bool
[src]
&mut self,
address: SocketAddr,
date: DateTime<Utc>
) -> bool
Move a peer from connected/disconnected to gossiped peers.
pub fn disconnect_peer(&mut self, address: SocketAddr) -> bool
[src]
Move a peer from connected peers to disconnected peers.
pub fn connected_total(&self) -> u16
[src]
Returns the number of connected peers.
pub fn store<T: Transaction, P: LoadableMerkleParameters>(
&self,
storage: &Ledger<T, P>
) -> Result<(), ServerError>
[src]
&self,
storage: &Ledger<T, P>
) -> Result<(), ServerError>
Writes connected peers to storage.
Trait Implementations
impl Clone for PeerBook
[src]
impl Debug for PeerBook
[src]
impl Eq for PeerBook
[src]
impl PartialEq<PeerBook> for PeerBook
[src]
impl StructuralEq for PeerBook
[src]
impl StructuralPartialEq for PeerBook
[src]
Auto Trait Implementations
impl RefUnwindSafe for PeerBook
impl Send for PeerBook
impl Sync for PeerBook
impl Unpin for PeerBook
impl UnwindSafe for PeerBook
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,
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.
fn to_owned(&self) -> T
[src]
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.
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.
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>,