20 #ifndef RIPPLE_APP_PEERS_PEERSET_H_INCLUDED
21 #define RIPPLE_APP_PEERS_PEERSET_H_INCLUDED
23 #include <ripple/app/main/Application.h>
24 #include <ripple/beast/clock/abstract_clock.h>
25 #include <ripple/beast/utility/Journal.h>
26 #include <ripple/overlay/Peer.h>
27 #include <boost/asio/basic_waitable_timer.hpp>
96 const protocol::TMGetLedger& message,
126 boost::asio::basic_waitable_timer<std::chrono::steady_clock>
mTimer;
virtual void onTimer(bool progress, ScopedLockType &)=0
Hook called from invokeOnTimer().
bool mProgress
Whether forward progress has been made.
void invokeOnTimer()
Calls onTimer() if in the right state.
boost::asio::basic_waitable_timer< std::chrono::steady_clock > mTimer
std::set< Peer::id_t > mPeers
The identifiers of the peers we are tracking.
virtual void queueJob()=0
Queue a job to call invokeOnTimer().
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.
const uint256 mHash
The hash of the object (in practice, always a ledger) we are trying to fetch.
void sendRequest(const protocol::TMGetLedger &message, std::shared_ptr< Peer > const &peer)
Send a GetLedger message to one or all peers.
PeerSet(Application &app, uint256 const &hash, std::chrono::milliseconds interval, beast::Journal journal)
A generic endpoint for log messages.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Supports data retrieval by managing a set of peers.
virtual void onPeerAdded(std::shared_ptr< Peer > const &)=0
Hook called from addPeers().
std::chrono::milliseconds mTimerInterval
The minimum time to wait between calls to execute().
virtual std::weak_ptr< PeerSet > pmDowncast()=0
Return a weak pointer to this.
void setTimer()
Schedule a call to queueJob() after mTimerInterval.
std::recursive_mutex mLock