Actual implementation for TxRequestTracker's data structure.
More...
|
void | SanityCheck () const |
|
void | PostGetRequestableSanityCheck (std::chrono::microseconds now) const |
|
| Impl (bool deterministic) |
|
| Impl (const Impl &)=delete |
|
Impl & | operator= (const Impl &)=delete |
|
void | DisconnectedPeer (NodeId peer) |
|
void | ForgetTxHash (const uint256 &txhash) |
|
void | ReceivedInv (NodeId peer, const GenTxid >xid, bool preferred, std::chrono::microseconds reqtime) |
|
std::vector< GenTxid > | GetRequestable (NodeId peer, std::chrono::microseconds now, std::vector< std::pair< NodeId, GenTxid > > *expired) |
| Find the GenTxids to request now from peer. More...
|
|
void | RequestedTx (NodeId peer, const uint256 &txhash, std::chrono::microseconds expiry) |
|
void | ReceivedResponse (NodeId peer, const uint256 &txhash) |
|
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 &txhash, NodeId peer, bool preferred) const |
|
|
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< ByTxHash > it) |
| Convert a CANDIDATE_DELAYED announcement into a CANDIDATE_READY. More...
|
|
void | ChangeAndReselect (Iter< ByTxHash > it, State new_state) |
| Change the state of an announcement to something non-IsSelected(). More...
|
|
bool | IsOnlyNonCompleted (Iter< ByTxHash > it) |
| Check if 'it' is the only announcement for a given txhash that isn't COMPLETED. More...
|
|
bool | MakeCompleted (Iter< ByTxHash > it) |
| Convert any announcement to a COMPLETED one. More...
|
|
void | SetTimePoint (std::chrono::microseconds now, std::vector< std::pair< NodeId, GenTxid > > *expired) |
| Make the data structure consistent with a given point in time: More...
|
|
Actual implementation for TxRequestTracker's data structure.
Definition at line 310 of file txrequest.cpp.
◆ Impl() [1/2]
TxRequestTracker::Impl::Impl |
( |
bool |
deterministic | ) |
|
|
inlineexplicit |
◆ Impl() [2/2]
TxRequestTracker::Impl::Impl |
( |
const Impl & |
| ) |
|
|
delete |
◆ ChangeAndReselect()
void TxRequestTracker::Impl::ChangeAndReselect |
( |
Iter< ByTxHash > |
it, |
|
|
State |
new_state |
|
) |
| |
|
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 430 of file txrequest.cpp.
◆ ComputePriority()
uint64_t TxRequestTracker::Impl::ComputePriority |
( |
const uint256 & |
txhash, |
|
|
NodeId |
peer, |
|
|
bool |
preferred |
|
) |
| const |
|
inline |
◆ Count()
size_t TxRequestTracker::Impl::Count |
( |
NodeId |
peer | ) |
const |
|
inline |
◆ CountCandidates()
size_t TxRequestTracker::Impl::CountCandidates |
( |
NodeId |
peer | ) |
const |
|
inline |
◆ CountInFlight()
size_t TxRequestTracker::Impl::CountInFlight |
( |
NodeId |
peer | ) |
const |
|
inline |
◆ DisconnectedPeer()
void TxRequestTracker::Impl::DisconnectedPeer |
( |
NodeId |
peer | ) |
|
|
inline |
◆ Erase()
template<typename Tag >
Iter< Tag > TxRequestTracker::Impl::Erase |
( |
Iter< Tag > |
it | ) |
|
|
inlineprivate |
◆ ForgetTxHash()
void TxRequestTracker::Impl::ForgetTxHash |
( |
const uint256 & |
txhash | ) |
|
|
inline |
◆ GetRequestable()
std::vector< GenTxid > TxRequestTracker::Impl::GetRequestable |
( |
NodeId |
peer, |
|
|
std::chrono::microseconds |
now, |
|
|
std::vector< std::pair< NodeId, GenTxid > > * |
expired |
|
) |
| |
|
inline |
Find the GenTxids to request now from peer.
Definition at line 597 of file txrequest.cpp.
◆ IsOnlyNonCompleted()
bool TxRequestTracker::Impl::IsOnlyNonCompleted |
( |
Iter< ByTxHash > |
it | ) |
|
|
inlineprivate |
Check if 'it' is the only announcement for a given txhash that isn't COMPLETED.
Definition at line 447 of file txrequest.cpp.
◆ MakeCompleted()
bool TxRequestTracker::Impl::MakeCompleted |
( |
Iter< ByTxHash > |
it | ) |
|
|
inlineprivate |
Convert any announcement to a COMPLETED one.
If there are no non-COMPLETED announcements left for this txhash, 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 466 of file txrequest.cpp.
◆ Modify()
template<typename Tag , typename Modifier >
void TxRequestTracker::Impl::Modify |
( |
Iter< Tag > |
it, |
|
|
Modifier |
modifier |
|
) |
| |
|
inlineprivate |
◆ operator=()
Impl & TxRequestTracker::Impl::operator= |
( |
const Impl & |
| ) |
|
|
delete |
◆ PostGetRequestableSanityCheck()
void TxRequestTracker::Impl::PostGetRequestableSanityCheck |
( |
std::chrono::microseconds |
now | ) |
const |
|
inline |
◆ PromoteCandidateReady()
void TxRequestTracker::Impl::PromoteCandidateReady |
( |
Iter< ByTxHash > |
it | ) |
|
|
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 401 of file txrequest.cpp.
◆ ReceivedInv()
void TxRequestTracker::Impl::ReceivedInv |
( |
NodeId |
peer, |
|
|
const GenTxid & |
gtxid, |
|
|
bool |
preferred, |
|
|
std::chrono::microseconds |
reqtime |
|
) |
| |
|
inline |
◆ ReceivedResponse()
void TxRequestTracker::Impl::ReceivedResponse |
( |
NodeId |
peer, |
|
|
const uint256 & |
txhash |
|
) |
| |
|
inline |
◆ RequestedTx()
void TxRequestTracker::Impl::RequestedTx |
( |
NodeId |
peer, |
|
|
const uint256 & |
txhash, |
|
|
std::chrono::microseconds |
expiry |
|
) |
| |
|
inline |
◆ SanityCheck()
void TxRequestTracker::Impl::SanityCheck |
( |
| ) |
const |
|
inline |
◆ SetTimePoint()
void TxRequestTracker::Impl::SetTimePoint |
( |
std::chrono::microseconds |
now, |
|
|
std::vector< std::pair< NodeId, GenTxid > > * |
expired |
|
) |
| |
|
inlineprivate |
Make the data structure consistent with a given point in time:
- REQUESTED announcements with expiry <= now are turned into COMPLETED.
- CANDIDATE_DELAYED announcements with reqtime <= now are turned into CANDIDATE_{READY,BEST}.
- CANDIDATE_{READY,BEST} announcements with reqtime > now are turned into CANDIDATE_DELAYED.
Definition at line 493 of file txrequest.cpp.
◆ Size()
size_t TxRequestTracker::Impl::Size |
( |
| ) |
const |
|
inline |
Count how many announcements are being tracked in total across all peers and transactions.
Definition at line 703 of file txrequest.cpp.
◆ m_computer
const PriorityComputer TxRequestTracker::Impl::m_computer |
|
private |
◆ m_current_sequence
SequenceNumber TxRequestTracker::Impl::m_current_sequence {0} |
|
private |
The current sequence number.
Increases for every announcement. This is used to sort txhashes returned by GetRequestable in announcement order.
Definition at line 313 of file txrequest.cpp.
◆ m_index
Index TxRequestTracker::Impl::m_index |
|
private |
◆ m_peerinfo
std::unordered_map<NodeId, PeerInfo> TxRequestTracker::Impl::m_peerinfo |
|
private |
Map with this tracker's per-peer statistics.
Definition at line 322 of file txrequest.cpp.
The documentation for this class was generated from the following file: