Bitcoin ABC 0.26.3
P2P Digital Currency
|
#include <invrequest.h>
Public Member Functions | |
InvRequestTracker (bool deterministic=false) | |
Construct a InvRequestTracker. | |
~InvRequestTracker ()=default | |
void | ReceivedInv (NodeId peer, const InvId &invid, bool preferred, std::chrono::microseconds reqtime) |
Adds a new CANDIDATE announcement. | |
void | DisconnectedPeer (NodeId peer) |
Deletes all announcements for a given peer. | |
void | ForgetInvId (const InvId &invid) |
Deletes all announcements for a given invid. | |
std::vector< InvId > | GetRequestable (NodeId peer, std::chrono::microseconds now, std::vector< std::pair< NodeId, InvId > > *expired) |
Find the invids to request now from peer. | |
void | RequestedData (NodeId peer, const InvId &invid, std::chrono::microseconds expiry) |
Marks an inventory as requested, with a specified expiry. | |
void | ReceivedResponse (NodeId peer, const InvId &invid) |
Converts a CANDIDATE or REQUESTED announcement to a COMPLETED one. | |
size_t | CountInFlight (NodeId peer) const |
Count how many REQUESTED announcements a peer has. | |
size_t | CountCandidates (NodeId peer) const |
Count how many CANDIDATE announcements a peer has. | |
size_t | Count (NodeId peer) const |
Count how many announcements a peer has (REQUESTED, CANDIDATE, and COMPLETED combined). | |
size_t | Size () const |
Count how many announcements are being tracked in total across all peers and inventory ids. | |
uint64_t | ComputePriority (const InvId &invid, NodeId peer, bool preferred) const |
Access to the internal priority computation (testing only) | |
void | SanityCheck () const |
Run internal consistency check (testing only). | |
void | PostGetRequestableSanityCheck (std::chrono::microseconds now) const |
Run a time-dependent internal consistency check (testing only). | |
Private Attributes | |
const std::unique_ptr< InvRequestTrackerImplInterface > | m_impl |
Definition at line 159 of file invrequest.h.
|
inlineexplicit |
Construct a InvRequestTracker.
Definition at line 171 of file invrequest.h.
|
default |
|
inline |
Access to the internal priority computation (testing only)
Definition at line 318 of file invrequest.h.
Count how many announcements a peer has (REQUESTED, CANDIDATE, and COMPLETED combined).
Definition at line 309 of file invrequest.h.
|
inline |
Count how many CANDIDATE announcements a peer has.
Definition at line 301 of file invrequest.h.
Count how many REQUESTED announcements a peer has.
Definition at line 296 of file invrequest.h.
Deletes all announcements for a given peer.
It should be called when a peer goes offline.
Definition at line 211 of file invrequest.h.
Deletes all announcements for a given invid.
This should be called when an inventory is no longer needed. The caller should ensure that new announcements for the same invid will not trigger new ReceivedInv calls, at least in the short term after this call.
Definition at line 220 of file invrequest.h.
|
inline |
Find the invids to request now from peer.
It does the following:
Definition at line 245 of file invrequest.h.
|
inline |
Run a time-dependent internal consistency check (testing only).
This can only be called immediately after GetRequestable, with the same 'now' parameter.
Definition at line 332 of file invrequest.h.
|
inline |
Adds a new CANDIDATE announcement.
Does nothing if one already exists for that (invid, peer) combination (whether it's CANDIDATE, REQUESTED, or COMPLETED).
Definition at line 201 of file invrequest.h.
|
inline |
Converts a CANDIDATE or REQUESTED announcement to a COMPLETED one.
If no such announcement exists for the provided peer and invid, nothing happens.
It should be called whenever an inventory or NOTFOUND was received from a peer. When the inventory is not needed entirely anymore, ForgetInvId should be called instead of, or in addition to, this call.
Definition at line 289 of file invrequest.h.
|
inline |
Marks an inventory as requested, with a specified expiry.
If no CANDIDATE announcement for the provided peer and invid exists, this call has no effect. Otherwise:
Definition at line 275 of file invrequest.h.
|
inline |
Run internal consistency check (testing only).
Definition at line 324 of file invrequest.h.
|
inline |
Count how many announcements are being tracked in total across all peers and inventory ids.
Definition at line 315 of file invrequest.h.
|
private |
Definition at line 167 of file invrequest.h.