Struct network::application::storage::PeerMetadataStorage [−][src]
pub struct PeerMetadataStorage { /* fields omitted */ }Expand description
Metadata storage for peers across all of networking. Splits storage of information across networks to prevent different networks from affecting each other
Implementations
Create a new PeerMetadataStorage NetworkIds must be known at construction time
pub fn read_filtered<F: FnMut(&(&PeerId, &PeerInfo)) -> bool>(
&self,
network_id: NetworkId,
filter: F
) -> HashMap<PeerNetworkId, PeerInfo>
Read a clone of the entire state
Insert new entry
Remove old entries
Take in a function to modify the data, must handle concurrency control with the input function
pub fn write_lock(
&self,
network_id: NetworkId
) -> RwLockWriteGuard<'_, HashMap<PeerId, PeerInfo>>
pub fn write_lock(
&self,
network_id: NetworkId
) -> RwLockWriteGuard<'_, HashMap<PeerId, PeerInfo>>
Get the underlying RwLock of the map. Usage is discouraged as it leads to the possiblity of
leaving the lock held for a long period of time. However, not everything fits into the write
model.
pub fn insert_connection(
&self,
network_id: NetworkId,
connection_metadata: ConnectionMetadata
)
pub fn remove_connection(
&self,
network_id: NetworkId,
connection_metadata: &ConnectionMetadata
)
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for PeerMetadataStorage
impl Send for PeerMetadataStorage
impl Sync for PeerMetadataStorage
impl Unpin for PeerMetadataStorage
impl UnwindSafe for PeerMetadataStorage
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
type Output = T
type Output = T
Should always be Self