1#ifndef XRPL_APP_LEDGER_INBOUNDLEDGER_H_INCLUDED
2#define XRPL_APP_LEDGER_INBOUNDLEDGER_H_INCLUDED
4#include <xrpld/app/ledger/Ledger.h>
5#include <xrpld/app/ledger/detail/TimeoutCounter.h>
6#include <xrpld/app/main/Application.h>
7#include <xrpld/overlay/PeerSet.h>
9#include <xrpl/basics/CountedObject.h>
typename Clock::time_point time_point
virtual time_point now() const =0
Returns the current time.
Tracks the number of instances of an object.
Json::Value getJson(int)
Return a Json::objectValue.
void runData()
Process pending TMLedgerData Query the a random sample of the 'best' peers.
std::size_t getPeerCount() const
void trigger(std::shared_ptr< Peer > const &, TriggerReason)
Request more nodes, perhaps from a specific peer.
void init(ScopedLockType &collectionLock)
clock_type::time_point mLastAction
std::set< uint256 > mRecentNodes
void receiveNode(protocol::TMLedgerData &packet, SHAMapAddNode &)
Process node data received from a peer Call with a lock.
bool isComplete() const
Returns true if we got all the data.
bool takeHeader(std::string const &data)
Take ledger header data Call with a lock.
void addPeers()
Add more peers to the set, if possible.
std::shared_ptr< Ledger const > getLedger() const
int processData(std::shared_ptr< Peer > peer, protocol::TMLedgerData &data)
Process one TMLedgerData Returns the number of useful nodes.
beast::abstract_clock< std::chrono::steady_clock > clock_type
std::uint32_t getSeq() const
clock_type::time_point getLastAction() const
std::shared_ptr< Ledger > mLedger
std::vector< uint256 > neededTxHashes(int max, SHAMapSyncFilter *filter) const
void tryDB(NodeStore::Database &srcDB)
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 *filter) const
bool isFailed() const
Returns false if we failed to get the data.
void filterNodes(std::vector< std::pair< SHAMapNodeID, uint256 > > &nodes, TriggerReason reason)
bool takeAsRootNode(Slice const &data, SHAMapAddNode &)
Process AS root node received from a peer Call with a lock.
std::weak_ptr< TimeoutCounter > pmDowncast() override
Return a weak pointer to this.
bool takeTxRootNode(Slice const &data, SHAMapAddNode &)
Process AS root node received from a peer Call with a lock.
std::vector< std::pair< std::weak_ptr< Peer >, std::shared_ptr< protocol::TMLedgerData > > > mReceivedData
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::vector< neededHash_t > getNeededHashes()
std::mutex mReceivedDataLock
void update(std::uint32_t seq)
std::unique_ptr< PeerSet > mPeerSet
Persistency layer for NodeObject.
An immutable linear range of bytes.
This class is an "active" object.
std::unique_lock< std::recursive_mutex > ScopedLockType
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.