[−][src]Trait hycon_rust::traits::PeerDB
Defines methods required for a peer database implementation
Required methods
fn get(&self, key: &KeyType) -> Option<PeerType>
An Option
containing the Peer corresponding to the given key, None
if not found
fn get_all(&self) -> Option<Vec<PeerType>>
Gets all peers from the DB
fn get_multiple(&self, limit: usize) -> Option<Vec<PeerType>>
Gets multiple peers from the DB
fn inbound_connection(
&mut self,
key: KeyType,
value: PeerType
) -> Result<(), Box<dyn Error>>
&mut self,
key: KeyType,
value: PeerType
) -> Result<(), Box<dyn Error>>
Handler for an inbound peer connection
fn outbound_connection(
&mut self,
key: KeyType,
value: PeerType
) -> Result<(), Box<dyn Error>>
&mut self,
key: KeyType,
value: PeerType
) -> Result<(), Box<dyn Error>>
Handler for an outbound peer connection
fn connection_failure(&mut self, key: &KeyType) -> Result<(), Box<dyn Error>>
Handler for a connection failure
fn disconnect(&mut self, key: &KeyType)
Handler for a disconnect event
fn put_multiple(
&mut self,
values: Vec<(KeyType, PeerType)>
) -> Result<(), Box<dyn Error>>
&mut self,
values: Vec<(KeyType, PeerType)>
) -> Result<(), Box<dyn Error>>
Puts multiple peers into the DB
fn get_recent(&self, limit: usize) -> Option<Vec<PeerType>>
Get peers that have been seen recently
fn get_seen(&self, limit: usize) -> Option<Vec<PeerType>>
Gets list of seen peers
fn get_oldest(&self, limit: usize) -> Option<Vec<PeerType>>
Gets peer that is the oldest
fn get_random(&self, limit: usize) -> Option<Vec<PeerType>>
Gets a random peer
Implementors
impl PeerDB<SocketAddr, DBPeer> for PeerDatabase<SocketAddr, DBPeer>
[src]
fn get(&self, key: &SocketAddr) -> Option<DBPeer>
[src]
fn get_all(&self) -> Option<Vec<DBPeer>>
[src]
fn get_multiple(&self, limit: usize) -> Option<Vec<DBPeer>>
[src]
fn inbound_connection(
&mut self,
key: SocketAddr,
value: DBPeer
) -> Result<(), Box<dyn Error>>
[src]
&mut self,
key: SocketAddr,
value: DBPeer
) -> Result<(), Box<dyn Error>>
fn outbound_connection(
&mut self,
key: SocketAddr,
value: DBPeer
) -> Result<(), Box<dyn Error>>
[src]
&mut self,
key: SocketAddr,
value: DBPeer
) -> Result<(), Box<dyn Error>>
fn connection_failure(&mut self, key: &SocketAddr) -> Result<(), Box<dyn Error>>
[src]
fn disconnect(&mut self, key: &SocketAddr)
[src]
fn put_multiple(
&mut self,
values: Vec<(SocketAddr, DBPeer)>
) -> Result<(), Box<dyn Error>>
[src]
&mut self,
values: Vec<(SocketAddr, DBPeer)>
) -> Result<(), Box<dyn Error>>