Struct snarkos_node_router::Cache
source · 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_message(
&self,
peer_ip: SocketAddr,
interval_in_secs: i64
) -> usize
pub fn insert_inbound_message( &self, peer_ip: SocketAddr, interval_in_secs: i64 ) -> usize
Inserts a new timestamp for the given peer message, returning the number of recent messages.
sourcepub fn insert_inbound_puzzle_request(&self, peer_ip: SocketAddr) -> usize
pub fn insert_inbound_puzzle_request(&self, peer_ip: SocketAddr) -> usize
Inserts a new timestamp for the given peer IP, returning the number of recent requests.
sourcepub fn insert_inbound_solution(
&self,
peer_ip: SocketAddr,
solution: PuzzleCommitment<N>
) -> Option<OffsetDateTime>
pub fn insert_inbound_solution( &self, peer_ip: SocketAddr, solution: PuzzleCommitment<N> ) -> Option<OffsetDateTime>
Inserts a solution commitment into the cache, returning the previously seen timestamp if it existed.
sourcepub fn insert_inbound_transaction(
&self,
peer_ip: SocketAddr,
transaction: N::TransactionID
) -> Option<OffsetDateTime>
pub fn insert_inbound_transaction( &self, peer_ip: SocketAddr, transaction: N::TransactionID ) -> Option<OffsetDateTime>
Inserts a transaction ID into the cache, returning the previously seen timestamp if it existed.
source§impl<N: Network> Cache<N>
impl<N: Network> Cache<N>
sourcepub fn contains_outbound_block_request(
&self,
peer_ip: &SocketAddr,
request: &BlockRequest
) -> bool
pub fn contains_outbound_block_request( &self, peer_ip: &SocketAddr, request: &BlockRequest ) -> bool
Returns true
if the cache contains the block request for the given peer.
sourcepub fn insert_outbound_block_request(
&self,
peer_ip: SocketAddr,
request: BlockRequest
) -> usize
pub fn insert_outbound_block_request( &self, peer_ip: SocketAddr, request: BlockRequest ) -> usize
Inserts the block request for the given peer IP, returning the number of recent requests.
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 IP, returning true
if the request was present.
sourcepub fn contains_outbound_puzzle_request(&self, peer_ip: &SocketAddr) -> bool
pub fn contains_outbound_puzzle_request(&self, peer_ip: &SocketAddr) -> bool
Returns true
if the cache contains a puzzle request from the given peer.
sourcepub fn increment_outbound_puzzle_requests(&self, peer_ip: SocketAddr) -> u16
pub fn increment_outbound_puzzle_requests(&self, peer_ip: SocketAddr) -> u16
Increment the peer IP’s number of puzzle requests, returning the updated number of puzzle requests.
sourcepub fn decrement_outbound_puzzle_requests(&self, peer_ip: SocketAddr) -> u16
pub fn decrement_outbound_puzzle_requests(&self, peer_ip: SocketAddr) -> u16
Decrement the peer IP’s number of puzzle requests, returning the updated number of puzzle requests.
sourcepub fn insert_outbound_solution(
&self,
peer_ip: SocketAddr,
solution: PuzzleCommitment<N>
) -> Option<OffsetDateTime>
pub fn insert_outbound_solution( &self, peer_ip: SocketAddr, solution: PuzzleCommitment<N> ) -> Option<OffsetDateTime>
Inserts a solution commitment into the cache, returning the previously seen timestamp if it existed.
sourcepub fn insert_outbound_transaction(
&self,
peer_ip: SocketAddr,
transaction: N::TransactionID
) -> Option<OffsetDateTime>
pub fn insert_outbound_transaction( &self, peer_ip: SocketAddr, transaction: N::TransactionID ) -> Option<OffsetDateTime>
Inserts a transaction ID into the cache, returning the previously seen timestamp if it existed.