Bitcoin ABC 0.30.7
P2P Digital Currency
|
#include <invrequest.h>
Public Member Functions | |
InvRequestTracker (bool deterministic=false) | |
Construct a InvRequestTracker. More... | |
~InvRequestTracker ()=default | |
void | ReceivedInv (NodeId peer, const InvId &invid, bool preferred, std::chrono::microseconds reqtime) |
Adds a new CANDIDATE announcement. More... | |
void | DisconnectedPeer (NodeId peer) |
Deletes all announcements for a given peer. More... | |
void | ForgetInvId (const InvId &invid) |
Deletes all announcements for a given invid. More... | |
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. More... | |
void | RequestedData (NodeId peer, const InvId &invid, std::chrono::microseconds expiry) |
Marks an inventory as requested, with a specified expiry. More... | |
void | ReceivedResponse (NodeId peer, const InvId &invid) |
Converts a CANDIDATE or REQUESTED announcement to a COMPLETED one. More... | |
size_t | CountInFlight (NodeId peer) const |
Count how many REQUESTED announcements a peer has. More... | |
size_t | CountCandidates (NodeId peer) const |
Count how many CANDIDATE announcements a peer has. More... | |
size_t | Count (NodeId peer) const |
Count how many announcements a peer has (REQUESTED, CANDIDATE, and COMPLETED combined). More... | |
size_t | Size () const |
Count how many announcements are being tracked in total across all peers and inventory ids. More... | |
uint64_t | ComputePriority (const InvId &invid, NodeId peer, bool preferred) const |
Access to the internal priority computation (testing only) More... | |
void | SanityCheck () const |
Run internal consistency check (testing only). More... | |
void | PostGetRequestableSanityCheck (std::chrono::microseconds now) const |
Run a time-dependent internal consistency check (testing only). More... | |
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.
|
inline |
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.
|
inline |
Count how many REQUESTED announcements a peer has.
Definition at line 296 of file invrequest.h.
|
inline |
Deletes all announcements for a given peer.
It should be called when a peer goes offline.
Definition at line 211 of file invrequest.h.
|
inline |
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.