|
rippled
|
Supports data retrieval by managing a set of peers. More...


Protected Types | |
| using | ScopedLockType = std::unique_lock< std::recursive_mutex > |
Protected Member Functions | |
| PeerSet (Application &app, uint256 const &hash, std::chrono::milliseconds interval, beast::Journal journal) | |
| virtual | ~PeerSet ()=0 |
| void | addPeers (std::size_t limit, std::function< bool(std::shared_ptr< Peer > const &)> score) |
Add at most limit peers to this set from the overlay. More... | |
| virtual void | onPeerAdded (std::shared_ptr< Peer > const &)=0 |
| Hook called from addPeers(). More... | |
| virtual void | onTimer (bool progress, ScopedLockType &)=0 |
| Hook called from invokeOnTimer(). More... | |
| virtual void | queueJob ()=0 |
| Queue a job to call invokeOnTimer(). More... | |
| virtual std::weak_ptr< PeerSet > | pmDowncast ()=0 |
| Return a weak pointer to this. More... | |
| bool | isDone () const |
| void | invokeOnTimer () |
| Calls onTimer() if in the right state. More... | |
| void | sendRequest (const protocol::TMGetLedger &message, std::shared_ptr< Peer > const &peer) |
| Send a GetLedger message to one or all peers. More... | |
| void | setTimer () |
| Schedule a call to queueJob() after mTimerInterval. More... | |
Protected Attributes | |
| Application & | app_ |
| beast::Journal | m_journal |
| std::recursive_mutex | mLock |
| const uint256 | mHash |
| The hash of the object (in practice, always a ledger) we are trying to fetch. More... | |
| int | mTimeouts |
| bool | mComplete |
| bool | mFailed |
| bool | mProgress |
| Whether forward progress has been made. More... | |
| std::set< Peer::id_t > | mPeers |
| The identifiers of the peers we are tracking. More... | |
Private Attributes | |
| std::chrono::milliseconds | mTimerInterval |
| The minimum time to wait between calls to execute(). More... | |
| boost::asio::basic_waitable_timer< std::chrono::steady_clock > | mTimer |
Supports data retrieval by managing a set of peers.
When desired data (such as a ledger or a transaction set) is missing locally it can be obtained by querying connected peers. This class manages common aspects of the retrieval. Callers maintain the set by adding and removing peers depending on whether the peers have useful information.
This class is an "active" object. It maintains its own timer and dispatches work to a job queue. Implementations derive from this class and override the abstract hook functions in the base.
The data is represented by its hash.
|
protected |
|
protected |
Definition at line 29 of file PeerSet.cpp.
|
protectedpure virtualdefault |
|
protected |
Add at most limit peers to this set from the overlay.
Definition at line 50 of file PeerSet.cpp.
|
protectedpure virtual |
Hook called from addPeers().
Implemented in ripple::InboundLedger, and ripple::TransactionAcquire.
|
protectedpure virtual |
Hook called from invokeOnTimer().
Implemented in ripple::InboundLedger, and ripple::TransactionAcquire.
|
protectedpure virtual |
Queue a job to call invokeOnTimer().
Implemented in ripple::InboundLedger, and ripple::TransactionAcquire.
|
protectedpure virtual |
Return a weak pointer to this.
Implemented in ripple::InboundLedger, and ripple::TransactionAcquire.
|
protected |
Calls onTimer() if in the right state.
Definition at line 101 of file PeerSet.cpp.
|
protected |
Send a GetLedger message to one or all peers.
Definition at line 127 of file PeerSet.cpp.
|
protected |
Schedule a call to queueJob() after mTimerInterval.
Definition at line 87 of file PeerSet.cpp.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
private |
|
private |
1.8.17