![]() |
Bitcoin ABC 0.34.5
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. | |
| void | GetCandidatePeers (const InvId &invid, std::vector< NodeId > &result_peers) const |
| For some invid, finds all peers with non-COMPLETED announcements and appends them to result_peers. | |
| 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 162 of file invrequest.h.
|
inlineexplicit |
Construct a InvRequestTracker.
Definition at line 174 of file invrequest.h.
|
default |
|
inline |
Access to the internal priority computation (testing only)
Definition at line 331 of file invrequest.h.
|
inline |
Count how many announcements a peer has (REQUESTED, CANDIDATE, and COMPLETED combined).
Definition at line 312 of file invrequest.h.
|
inline |
Count how many CANDIDATE announcements a peer has.
Definition at line 304 of file invrequest.h.
|
inline |
Count how many REQUESTED announcements a peer has.
Definition at line 299 of file invrequest.h.
|
inline |
Deletes all announcements for a given peer.
It should be called when a peer goes offline.
Definition at line 214 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 223 of file invrequest.h.
|
inline |
For some invid, finds all peers with non-COMPLETED announcements and appends them to result_peers.
Does not try to ensure that result_peers contains no duplicates.
Definition at line 325 of file invrequest.h.
|
inline |
Find the invids to request now from peer.
It does the following:
Definition at line 248 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 345 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 204 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 292 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 278 of file invrequest.h.
|
inline |
Run internal consistency check (testing only).
Definition at line 337 of file invrequest.h.
|
inline |
Count how many announcements are being tracked in total across all peers and inventory ids.
Definition at line 318 of file invrequest.h.
|
private |
Definition at line 170 of file invrequest.h.