pub struct Cache<N: Network> { /* private fields */ }Implementations§
Source§impl<N: Network> Cache<N>
impl<N: Network> Cache<N>
Sourcepub fn insert_inbound_connection(
&self,
peer_ip: IpAddr,
interval_in_secs: i64,
) -> usize
pub fn insert_inbound_connection( &self, peer_ip: IpAddr, interval_in_secs: i64, ) -> usize
Inserts a new timestamp for the given peer connection, returning the number of recent connection requests.
Sourcepub fn insert_inbound_event(
&self,
peer_ip: SocketAddr,
interval_in_secs: i64,
) -> usize
pub fn insert_inbound_event( &self, peer_ip: SocketAddr, interval_in_secs: i64, ) -> usize
Inserts a new timestamp for the given peer, returning the number of recent events.
Sourcepub fn insert_inbound_certificate(
&self,
key: Field<N>,
interval_in_secs: i64,
) -> usize
pub fn insert_inbound_certificate( &self, key: Field<N>, interval_in_secs: i64, ) -> usize
Inserts a certificate ID into the cache, returning the number of recent events.
Sourcepub fn insert_inbound_transmission(
&self,
key: TransmissionID<N>,
interval_in_secs: i64,
) -> usize
pub fn insert_inbound_transmission( &self, key: TransmissionID<N>, interval_in_secs: i64, ) -> usize
Inserts a transmission ID into the cache, returning the number of recent events.
Sourcepub fn insert_inbound_block_request(
&self,
key: SocketAddr,
interval_in_secs: i64,
) -> usize
pub fn insert_inbound_block_request( &self, key: SocketAddr, interval_in_secs: i64, ) -> usize
Inserts a block request into the cache, returning the number of recent events.
Source§impl<N: Network> Cache<N>
impl<N: Network> Cache<N>
Sourcepub fn insert_outbound_event(
&self,
peer_ip: SocketAddr,
interval_in_secs: i64,
) -> usize
pub fn insert_outbound_event( &self, peer_ip: SocketAddr, interval_in_secs: i64, ) -> usize
Inserts a new timestamp for the given peer, returning the number of recent events.
Sourcepub fn insert_outbound_certificate(
&self,
peer_ip: SocketAddr,
interval_in_secs: i64,
) -> usize
pub fn insert_outbound_certificate( &self, peer_ip: SocketAddr, interval_in_secs: i64, ) -> usize
Inserts a new timestamp for the given peer, returning the number of recent events.
Sourcepub fn insert_outbound_transmission(
&self,
peer_ip: SocketAddr,
interval_in_secs: i64,
) -> usize
pub fn insert_outbound_transmission( &self, peer_ip: SocketAddr, interval_in_secs: i64, ) -> usize
Inserts a new timestamp for the given peer, returning the number of recent events.
Source§impl<N: Network> Cache<N>
impl<N: Network> Cache<N>
Sourcepub fn contains_outbound_validators_request(&self, peer_ip: SocketAddr) -> bool
pub fn contains_outbound_validators_request(&self, peer_ip: SocketAddr) -> bool
Returns true if the cache contains a validators request from the given IP.
Sourcepub fn increment_outbound_validators_requests(&self, peer_ip: SocketAddr) -> u32
pub fn increment_outbound_validators_requests(&self, peer_ip: SocketAddr) -> u32
Increment the IP’s number of validators requests, returning the updated number of validators requests.
Sourcepub fn decrement_outbound_validators_requests(&self, peer_ip: SocketAddr) -> u32
pub fn decrement_outbound_validators_requests(&self, peer_ip: SocketAddr) -> u32
Decrement the IP’s number of validators requests, returning the updated number of validators requests.
Sourcepub fn clear_outbound_validators_requests(&self, peer_ip: SocketAddr)
pub fn clear_outbound_validators_requests(&self, peer_ip: SocketAddr)
Clears the the IP’s number of validator requests.
Sourcepub fn insert_outbound_block_request(
&self,
peer_ip: SocketAddr,
request: BlockRequest,
)
pub fn insert_outbound_block_request( &self, peer_ip: SocketAddr, request: BlockRequest, )
Inserts the block request for the given peer.
Sourcepub fn remove_outbound_block_request(
&self,
peer_ip: SocketAddr,
request: &BlockRequest,
) -> bool
pub fn remove_outbound_block_request( &self, peer_ip: SocketAddr, request: &BlockRequest, ) -> bool
Removes the block request for the given peer. Returns whether the request was present.
Sourcepub fn clear_outbound_block_requests(&self, peer_ip: SocketAddr)
pub fn clear_outbound_block_requests(&self, peer_ip: SocketAddr)
Clears the peer’s number of outbound block requests.
Trait Implementations§
Auto Trait Implementations§
impl<N> !Freeze for Cache<N>
impl<N> !RefUnwindSafe for Cache<N>
impl<N> Send for Cache<N>
impl<N> Sync for Cache<N>
impl<N> Unpin for Cache<N>
impl<N> UnwindSafe for Cache<N>where
<N as Environment>::Field: RefUnwindSafe,
<N as Network>::TransmissionChecksum: RefUnwindSafe,
<N as Network>::TransactionID: RefUnwindSafe,
N: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more