pub trait Store {
Show 14 methods
// Required methods
fn get(&self, id: &PublicKey) -> Result<Option<Node>, Error>;
fn addresses_of(&self, node: &PublicKey) -> Result<Vec<KnownAddress>, Error>;
fn insert(
&mut self,
node: &PublicKey,
version: u8,
features: Features,
alias: &Alias,
pow: u32,
agent: &UserAgent,
timestamp: Timestamp,
addrs: impl IntoIterator<Item = KnownAddress>,
) -> Result<bool, Error>;
fn remove(&mut self, id: &PublicKey) -> Result<bool, Error>;
fn len(&self) -> Result<usize, Error>;
fn nodes(&self) -> Result<usize, Error>;
fn is_addr_banned(&self, addr: &Address) -> Result<bool, Error>;
fn is_ip_banned(&self, ip: IpAddr) -> Result<bool, Error>;
fn entries(&self) -> Result<Box<dyn Iterator<Item = AddressEntry>>, Error>;
fn attempted(
&self,
nid: &PublicKey,
addr: &Address,
time: Timestamp,
) -> Result<(), Error>;
fn connected(
&self,
nid: &PublicKey,
addr: &Address,
time: Timestamp,
) -> Result<(), Error>;
fn record_ip(
&self,
nid: &PublicKey,
ip: IpAddr,
time: Timestamp,
) -> Result<(), Error>;
fn disconnected(
&mut self,
nid: &PublicKey,
addr: &Address,
severity: Severity,
) -> Result<(), Error>;
// Provided method
fn is_empty(&self) -> Result<bool, Error> { ... }
}Expand description
Address store.
Used to store node addresses and metadata.
Required Methods§
Sourcefn get(&self, id: &PublicKey) -> Result<Option<Node>, Error>
fn get(&self, id: &PublicKey) -> Result<Option<Node>, Error>
Get the information we have about a node.
Sourcefn addresses_of(&self, node: &PublicKey) -> Result<Vec<KnownAddress>, Error>
fn addresses_of(&self, node: &PublicKey) -> Result<Vec<KnownAddress>, Error>
Get the addresses of a node.
Sourcefn insert(
&mut self,
node: &PublicKey,
version: u8,
features: Features,
alias: &Alias,
pow: u32,
agent: &UserAgent,
timestamp: Timestamp,
addrs: impl IntoIterator<Item = KnownAddress>,
) -> Result<bool, Error>
fn insert( &mut self, node: &PublicKey, version: u8, features: Features, alias: &Alias, pow: u32, agent: &UserAgent, timestamp: Timestamp, addrs: impl IntoIterator<Item = KnownAddress>, ) -> Result<bool, Error>
Insert a node with associated addresses into the store.
Returns true if the node or addresses were updated, and false otherwise.
Sourcefn is_addr_banned(&self, addr: &Address) -> Result<bool, Error>
fn is_addr_banned(&self, addr: &Address) -> Result<bool, Error>
Check if an address is banned. Also returns true if the node this address belongs
to is banned.
Sourcefn entries(&self) -> Result<Box<dyn Iterator<Item = AddressEntry>>, Error>
fn entries(&self) -> Result<Box<dyn Iterator<Item = AddressEntry>>, Error>
Get the address entries in the store.
Sourcefn attempted(
&self,
nid: &PublicKey,
addr: &Address,
time: Timestamp,
) -> Result<(), Error>
fn attempted( &self, nid: &PublicKey, addr: &Address, time: Timestamp, ) -> Result<(), Error>
Mark a node as attempted at a certain time.
Sourcefn connected(
&self,
nid: &PublicKey,
addr: &Address,
time: Timestamp,
) -> Result<(), Error>
fn connected( &self, nid: &PublicKey, addr: &Address, time: Timestamp, ) -> Result<(), Error>
Mark a node as successfully connected at a certain time.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.