Bitcoin ABC 0.30.7
P2P Digital Currency
|
Actual implementation for InvRequestTracker's data structure. More...
Public Member Functions | |
void | SanityCheck () const |
void | PostGetRequestableSanityCheck (std::chrono::microseconds now) const |
InvRequestTrackerImpl (bool deterministic) | |
InvRequestTrackerImpl (const InvRequestTrackerImpl &)=delete | |
InvRequestTrackerImpl & | operator= (const InvRequestTrackerImpl &)=delete |
~InvRequestTrackerImpl ()=default | |
void | DisconnectedPeer (NodeId peer) |
void | ForgetInvId (const uint256 &invid) |
void | ReceivedInv (NodeId peer, const uint256 &invid, bool preferred, std::chrono::microseconds reqtime) |
std::vector< uint256 > | GetRequestable (NodeId peer, std::chrono::microseconds now, ClearExpiredFun clearExpired, EmplaceExpiredFun emplaceExpired) |
Find the InvIds to request now from peer. More... | |
void | RequestedData (NodeId peer, const uint256 &invid, std::chrono::microseconds expiry) |
void | ReceivedResponse (NodeId peer, const uint256 &invid) |
size_t | CountInFlight (NodeId peer) const |
size_t | CountCandidates (NodeId peer) const |
size_t | Count (NodeId peer) const |
size_t | Size () const |
Count how many announcements are being tracked in total across all peers and transactions. More... | |
uint64_t | ComputePriority (const uint256 &invid, NodeId peer, bool preferred) const |
Public Member Functions inherited from InvRequestTrackerImplInterface | |
virtual | ~InvRequestTrackerImplInterface ()=default |
virtual void | ReceivedInv (NodeId peer, const uint256 &invid, bool preferred, std::chrono::microseconds reqtime)=0 |
virtual void | DisconnectedPeer (NodeId peer)=0 |
virtual void | ForgetInvId (const uint256 &invid)=0 |
virtual std::vector< uint256 > | GetRequestable (NodeId peer, std::chrono::microseconds now, ClearExpiredFun clearExpired, EmplaceExpiredFun emplaceExpired)=0 |
virtual void | RequestedData (NodeId peer, const uint256 &invid, std::chrono::microseconds expiry)=0 |
virtual void | ReceivedResponse (NodeId peer, const uint256 &invid)=0 |
virtual size_t | CountInFlight (NodeId peer) const =0 |
virtual size_t | CountCandidates (NodeId peer) const =0 |
virtual size_t | Count (NodeId peer) const =0 |
virtual size_t | Size () const =0 |
virtual uint64_t | ComputePriority (const uint256 &invid, NodeId peer, bool preferred) const =0 |
virtual void | SanityCheck () const =0 |
virtual void | PostGetRequestableSanityCheck (std::chrono::microseconds now) const =0 |
Private Member Functions | |
template<typename Tag > | |
Iter< Tag > | Erase (Iter< Tag > it) |
Wrapper around Index::...::erase that keeps m_peerinfo up to date. More... | |
template<typename Tag , typename Modifier > | |
void | Modify (Iter< Tag > it, Modifier modifier) |
Wrapper around Index::...::modify that keeps m_peerinfo up to date. More... | |
void | PromoteCandidateReady (Iter< ByInvId > it) |
Convert a CANDIDATE_DELAYED announcement into a CANDIDATE_READY. More... | |
void | ChangeAndReselect (Iter< ByInvId > it, State new_state) |
Change the state of an announcement to something non-IsSelected(). More... | |
bool | IsOnlyNonCompleted (Iter< ByInvId > it) |
Check if 'it' is the only announcement for a given invid that isn't COMPLETED. More... | |
bool | MakeCompleted (Iter< ByInvId > it) |
Convert any announcement to a COMPLETED one. More... | |
void | SetTimePoint (std::chrono::microseconds now, ClearExpiredFun clearExpired, EmplaceExpiredFun emplaceExpired) |
Make the data structure consistent with a given point in time: More... | |
Private Attributes | |
SequenceNumber | m_current_sequence {0} |
The current sequence number. More... | |
const PriorityComputer | m_computer |
This tracker's priority computer. More... | |
Index | m_index |
This tracker's main data structure. More... | |
std::unordered_map< NodeId, PeerInfo > | m_peerinfo |
Map with this tracker's per-peer statistics. More... | |
Additional Inherited Members | |
Public Types inherited from InvRequestTrackerImplInterface | |
using | ClearExpiredFun = const std::function< void()> & |
using | EmplaceExpiredFun = const std::function< void(const NodeId &, const uint256 &)> & |
Actual implementation for InvRequestTracker's data structure.
Definition at line 356 of file invrequest.cpp.
|
inlineexplicit |
Definition at line 623 of file invrequest.cpp.
|
delete |
|
default |
|
inlineprivate |
Change the state of an announcement to something non-IsSelected().
If it was IsSelected(), the next best announcement will be marked CANDIDATE_BEST.
Definition at line 499 of file invrequest.cpp.
|
inlinevirtual |
Implements InvRequestTrackerImplInterface.
Definition at line 855 of file invrequest.cpp.
|
inlinevirtual |
Implements InvRequestTrackerImplInterface.
Definition at line 843 of file invrequest.cpp.
|
inlinevirtual |
Implements InvRequestTrackerImplInterface.
Definition at line 834 of file invrequest.cpp.
|
inlinevirtual |
Implements InvRequestTrackerImplInterface.
Definition at line 826 of file invrequest.cpp.
|
inlinevirtual |
Implements InvRequestTrackerImplInterface.
Definition at line 641 of file invrequest.cpp.
|
inlineprivate |
Wrapper around Index::...::erase that keeps m_peerinfo up to date.
Definition at line 433 of file invrequest.cpp.
|
inlinevirtual |
Implements InvRequestTrackerImplInterface.
Definition at line 683 of file invrequest.cpp.
|
inlinevirtual |
Find the InvIds to request now from peer.
Implements InvRequestTrackerImplInterface.
Definition at line 718 of file invrequest.cpp.
|
inlineprivate |
Check if 'it' is the only announcement for a given invid that isn't COMPLETED.
Definition at line 522 of file invrequest.cpp.
|
inlineprivate |
Convert any announcement to a COMPLETED one.
If there are no non-COMPLETED announcements left for this invid, they are deleted. If this was a REQUESTED announcement, and there are other CANDIDATEs left, the best one is made CANDIDATE_BEST. Returns whether the announcement still exists.
Definition at line 553 of file invrequest.cpp.
|
inlineprivate |
Wrapper around Index::...::modify that keeps m_peerinfo up to date.
Definition at line 445 of file invrequest.cpp.
|
delete |
|
inlinevirtual |
Implements InvRequestTrackerImplInterface.
Definition at line 414 of file invrequest.cpp.
|
inlineprivate |
Convert a CANDIDATE_DELAYED announcement into a CANDIDATE_READY.
If this makes it the new best CANDIDATE_READY (and no REQUESTED exists) and better than the CANDIDATE_BEST (if any), it becomes the new CANDIDATE_BEST.
Definition at line 458 of file invrequest.cpp.
|
inlinevirtual |
Implements InvRequestTrackerImplInterface.
Definition at line 691 of file invrequest.cpp.
Implements InvRequestTrackerImplInterface.
Definition at line 814 of file invrequest.cpp.
|
inlinevirtual |
Implements InvRequestTrackerImplInterface.
Definition at line 751 of file invrequest.cpp.
|
inlinevirtual |
Implements InvRequestTrackerImplInterface.
Definition at line 372 of file invrequest.cpp.
|
inlineprivate |
Make the data structure consistent with a given point in time:
Definition at line 585 of file invrequest.cpp.
|
inlinevirtual |
Count how many announcements are being tracked in total across all peers and transactions.
Implements InvRequestTrackerImplInterface.
Definition at line 853 of file invrequest.cpp.
|
private |
This tracker's priority computer.
Definition at line 362 of file invrequest.cpp.
|
private |
The current sequence number.
Increases for every announcement. This is used to sort invid returned by GetRequestable in announcement order.
Definition at line 359 of file invrequest.cpp.
|
private |
This tracker's main data structure.
See SanityCheck() for the invariants that apply to it.
Definition at line 366 of file invrequest.cpp.
|
private |
Map with this tracker's per-peer statistics.
Definition at line 369 of file invrequest.cpp.