20 #ifndef RIPPLE_APP_LEDGER_INBOUNDLEDGER_H_INCLUDED
21 #define RIPPLE_APP_LEDGER_INBOUNDLEDGER_H_INCLUDED
23 #include <ripple/app/ledger/Ledger.h>
24 #include <ripple/app/ledger/impl/TimeoutCounter.h>
25 #include <ripple/app/main/Application.h>
26 #include <ripple/basics/CountedObject.h>
27 #include <ripple/overlay/PeerSet.h>
std::set< uint256 > mRecentNodes
std::vector< neededHash_t > getNeededHashes()
Json::Value getJson(int)
Return a Json::objectValue.
std::unique_lock< std::recursive_mutex > ScopedLockType
Tracks the number of instances of an object.
Persistency layer for NodeObject.
std::uint32_t getSeq() const
An immutable linear range of bytes.
std::shared_ptr< Ledger const > getLedger() const
void update(std::uint32_t seq)
void filterNodes(std::vector< std::pair< SHAMapNodeID, uint256 >> &nodes, TriggerReason reason)
bool isFailed() const
Returns false if we failed to get the data.
int processData(std::shared_ptr< Peer > peer, protocol::TMLedgerData &data)
Process one TMLedgerData Returns the number of useful nodes.
std::vector< uint256 > neededStateHashes(int max, SHAMapSyncFilter *filter) const
std::pair< protocol::TMGetObjectByHash::ObjectType, uint256 > neededHash_t
std::unique_ptr< PeerSet > mPeerSet
This class is an "active" object.
LedgerInfo deserializePrefixedHeader(Slice data, bool hasHash)
Deserialize a ledger header (prefixed with 4 bytes) from a byte array.
virtual time_point now() const =0
Returns the current time.
std::vector< uint256 > neededTxHashes(int max, SHAMapSyncFilter *filter) const
bool takeHeader(std::string const &data)
Take ledger header data Call with a lock.
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 > mLedger
beast::abstract_clock< std::chrono::steady_clock > clock_type
clock_type::time_point mLastAction
clock_type::time_point getLastAction() const
std::size_t getPeerCount() const
void addPeers()
Add more peers to the set, if possible.
InboundLedger(Application &app, uint256 const &hash, std::uint32_t seq, Reason reason, clock_type &, std::unique_ptr< PeerSet > peerSet)
void tryDB(NodeStore::Database &srcDB)
bool takeTxRootNode(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::weak_ptr< TimeoutCounter > pmDowncast() override
Return a weak pointer to this.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
LedgerInfo deserializeHeader(Slice data, bool hasHash)
Deserialize a ledger header from a byte array.
bool takeAsRootNode(Slice const &data, SHAMapAddNode &)
Process AS root node received from a peer Call with a lock.
void trigger(std::shared_ptr< Peer > const &, TriggerReason)
Request more nodes, perhaps from a specific peer.
Information about the notional ledger backing the view.
void receiveNode(protocol::TMLedgerData &packet, SHAMapAddNode &)
Process node data received from a peer Call with a lock.
void runData()
Process pending TMLedgerData Query the a random sample of the 'best' peers.
void onTimer(bool progress, ScopedLockType &peerSetLock) override
Called with a lock by the PeerSet when the timer expires.
typename std::chrono::steady_clock ::time_point time_point
std::mutex mReceivedDataLock
std::vector< std::pair< std::weak_ptr< Peer >, std::shared_ptr< protocol::TMLedgerData > > > mReceivedData
void init(ScopedLockType &collectionLock)