3#include <xrpld/app/ledger/detail/TimeoutCounter.h>
4#include <xrpld/app/main/Application.h>
5#include <xrpld/overlay/PeerSet.h>
7#include <xrpl/basics/CountedObject.h>
8#include <xrpl/ledger/Ledger.h>
Abstract interface to a clock.
std::chrono::steady_clock::time_point time_point
clock_type::time_point lastAction_
json::Value getJson(int)
Return a json::ValueType::Object.
void trigger(std::shared_ptr< Peer > const &, TriggerReason)
Request more nodes, perhaps from a specific peer.
InboundLedger(Application &app, uint256 const &hash, std::uint32_t seq, Reason reason, clock_type &, std::unique_ptr< PeerSet > peerSet)
std::weak_ptr< TimeoutCounter > pmDowncast() override
Return a weak pointer to this.
void runData()
Process pending TMLedgerData Query the a random sample of the 'best' peers.
void tryDB(NodeStore::Database &srcDB)
std::size_t getPeerCount() const
void onTimer(bool progress, ScopedLockType &peerSetLock) override
Called with a lock by the PeerSet when the timer expires.
std::vector< uint256 > neededStateHashes(int max, SHAMapSyncFilter const *filter) const
int processData(std::shared_ptr< Peer > peer, protocol::TMLedgerData const &data)
Process one TMLedgerData Returns the number of useful nodes.
void filterNodes(std::vector< std::pair< SHAMapNodeID, uint256 > > &nodes, TriggerReason reason)
std::shared_ptr< Ledger > ledger_
bool takeAsRootNode(Slice const &data, SHAMapAddNode &)
Process AS root node received from a peer Call with a lock.
bool isComplete() const
Returns true if we got all the data.
std::vector< std::pair< std::weak_ptr< Peer >, std::shared_ptr< protocol::TMLedgerData > > > receivedData_
bool takeHeader(std::string const &data)
Take ledger header data Call with a lock.
std::pair< protocol::TMGetObjectByHash::ObjectType, uint256 > neededHash_t
std::uint32_t getSeq() const
std::mutex receivedDataLock_
bool takeTxRootNode(Slice const &data, SHAMapAddNode &)
Process AS root node received from a peer Call with a lock.
std::unique_ptr< PeerSet > peerSet_
void addPeers()
Add more peers to the set, if possible.
beast::AbstractClock< std::chrono::steady_clock > clock_type
void init(ScopedLockType &collectionLock)
void update(std::uint32_t seq)
void receiveNode(protocol::TMLedgerData const &packet, SHAMapAddNode &)
Process node data received from a peer Call with a lock.
bool isFailed() const
Returns false if we failed to get the data.
std::vector< uint256 > neededTxHashes(int max, SHAMapSyncFilter const *filter) const
clock_type::time_point getLastAction() const
std::set< uint256 > recentNodes_
bool gotData(std::weak_ptr< Peer >, std::shared_ptr< protocol::TMLedgerData > const &)
Stash a TMLedgerData received from a peer for later processing Returns 'true' if we need to dispatch.
std::shared_ptr< Ledger const > getLedger() const
std::vector< neededHash_t > getNeededHashes()
~InboundLedger() override
Persistency layer for NodeObject.
An immutable linear range of bytes.
TimeoutCounter(Application &app, uint256 const &targetHash, std::chrono::milliseconds timeoutInterval, QueueJobParameter &&jobParameter, beast::Journal journal)
std::unique_lock< std::recursive_mutex > ScopedLockType
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.