|
| | RequestCountingPeerSet (std::vector< std::shared_ptr< Peer > > candidates={}) |
| void | addPeers (std::size_t limit, std::function< bool(std::shared_ptr< Peer > const &)> hasItem, std::function< void(std::shared_ptr< Peer > const &)> onPeerAdded) override |
| | Offer the candidates to the caller, the way the real peer set offers the peers the overlay is tracking.
|
| void | sendRequest (::google::protobuf::Message const &, protocol::MessageType, std::shared_ptr< Peer > const &peer) override |
| | Record the request, and record it in the broadcast count as well when it names no peer.
|
| std::set< Peer::ID > const & | getPeerIds () const override |
| | The ids of every peer addPeers() has selected, which is what an acquisition takes for the peers it is tracking.
|
| int | requests () const |
| int | broadcasts () const |
| | How many of those requests carried no peer of their own.
|
| std::optional< std::size_t > | firstLimit () const |
| | The limit the first addPeers() call asked for, which is init()'s, since onTimer() keeps calling addPeers(1) for as long as an acquisition runs.
|
| std::set< Peer::ID > | addedPeers () const |
| | A set, because onTimer() keeps re-offering the same candidates.
|
| virtual void | addPeers (std::size_t limit, std::function< bool(std::shared_ptr< Peer > const &)> hasItem, std::function< void(std::shared_ptr< Peer > const &)> onPeerAdded)=0 |
| | Try add more peers.
|
| template<typename MessageType> |
| void | sendRequest (MessageType const &message, std::shared_ptr< Peer > const &peer) |
| | send a message
|
| virtual void | sendRequest (::google::protobuf::Message const &message, protocol::MessageType type, std::shared_ptr< Peer > const &peer)=0 |
A peer set that counts the requests an acquisition makes through it.
Offers peers to a hasItem/onPeerAdded callback pair, hard-filtered by hasItem (which only scores in the real peer set) and deduped by tracked id.
A count is a call, not a delivery: a request naming no peer reaches nobody while this set tracks none. requests() and broadcasts() are counted apart.
Every write here is guarded, since the retry timer drives addPeers() and sendRequest() from a job thread while the test reads the results.
Definition at line 128 of file AcquireTestHelpers.h.
| std::set< Peer::ID > const & xrpl::test::RequestCountingPeerSet::getPeerIds |
( |
| ) |
const |
|
nodiscardoverridevirtual |
The ids of every peer addPeers() has selected, which is what an acquisition takes for the peers it is tracking.
Unguarded: every caller of this and of addPeers() is an acquisition holding its own mtx_, so the ids stay fixed while a caller iterates. A test thread reads addedPeers() instead. InboundLedger::getPeerCount() reports zero for these, since it resolves ids through the overlay, while these peers live only in this harness.
- Returns
- The ids.
Implements xrpl::PeerSet.
Definition at line 208 of file AcquireTestHelpers.h.