|
xrpld
|
#include <InboundLedger.h>


Public Types | |
| enum class | Reason { HISTORY , GENERIC , CONSENSUS } |
| using | clock_type = beast::AbstractClock<std::chrono::steady_clock> |
| using | neededHash_t = std::pair<protocol::TMGetObjectByHash::ObjectType, uint256> |
Public Member Functions | |
| InboundLedger (Application &app, uint256 const &hash, std::uint32_t seq, Reason reason, clock_type &, std::unique_ptr< PeerSet > peerSet) | |
| ~InboundLedger () override | |
| void | update (std::uint32_t seq) |
| bool | isComplete () const |
| Returns true if we got all the data. | |
| bool | isFailed () const |
| Returns false if we failed to get the data. | |
| std::shared_ptr< Ledger const > | getLedger () const |
| std::uint32_t | getSeq () const |
| bool | checkLocal () |
| void | init (ScopedLockType &collectionLock) |
| 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. | |
| json::Value | getJson (int) |
| Return a json::ValueType::Object. | |
| void | runData () |
| Process pending TMLedgerData Query the a random sample of the 'best' peers. | |
| void | touch () |
| clock_type::time_point | getLastAction () const |
| virtual void | cancel () |
| Cancel the task by marking it as failed if the task is not done. | |
| T | shared_from_this (T... args) |
| T | weak_from_this (T... args) |
Public Attributes | |
| friend | Object |
Protected Types | |
| using | ScopedLockType = std::unique_lock<std::recursive_mutex> |
Protected Member Functions | |
| void | setTimer (ScopedLockType &) |
| Schedule a call to queueJob() after timerInterval_. | |
| void | queueJob (ScopedLockType &) |
| Queue a job to call invokeOnTimer(). | |
| bool | isDone () const |
Protected Attributes | |
| Application & | app_ |
| beast::Journal | journal_ |
| std::recursive_mutex | mtx_ |
| uint256 const | hash_ |
| The hash of the object (in practice, always a ledger) we are trying to fetch. | |
| int | timeouts_ {0} |
| bool | complete_ {false} |
| bool | failed_ {false} |
| bool | progress_ {false} |
| Whether forward progress has been made. | |
| std::chrono::milliseconds | timerInterval_ |
| The minimum time to wait between calls to execute(). | |
| QueueJobParameter | queueJobParameter_ |
Private Types | |
| enum class | TriggerReason { Added , Reply , Timeout } |
Private Member Functions | |
| void | filterNodes (std::vector< std::pair< SHAMapNodeID, uint256 > > &nodes, TriggerReason reason) |
| void | trigger (std::shared_ptr< Peer > const &, TriggerReason) |
| Request more nodes, perhaps from a specific peer. | |
| std::vector< neededHash_t > | getNeededHashes () |
| void | addPeers () |
| Add more peers to the set, if possible. | |
| void | tryDB (node_store::Database &srcDB) |
| void | done () |
| void | onTimer (bool progress, ScopedLockType &peerSetLock) override |
| Called with a lock by the PeerSet when the timer expires. | |
| std::size_t | getPeerCount () const |
| std::weak_ptr< TimeoutCounter > | pmDowncast () override |
| Return a weak pointer to this. | |
| int | processData (std::shared_ptr< Peer > peer, protocol::TMLedgerData const &data) |
| Process one TMLedgerData Returns the number of useful nodes. | |
| bool | takeHeader (std::string_view data) |
| Take ledger header data Call with a lock. | |
| void | receiveNode (std::shared_ptr< Peer > const &peer, protocol::TMLedgerData const &packet, SHAMapAddNode &san) |
| Process node data received from a peer Call with a lock. | |
| bool | takeTxRootNode (std::string_view data, SHAMapAddNode &san) |
| Process AS root node received from a peer Call with a lock. | |
| bool | takeAsRootNode (std::string_view data, SHAMapAddNode &san) |
| Process AS root node received from a peer Call with a lock. | |
| std::vector< uint256 > | neededTxHashes (int max, SHAMapSyncFilter const *filter) const |
| std::vector< uint256 > | neededStateHashes (int max, SHAMapSyncFilter const *filter) const |
| void | invokeOnTimer () |
| Calls onTimer() if in the right state. | |
Static Private Member Functions | |
| static auto & | getCounter () noexcept |
Private Attributes | |
| clock_type & | clock_ |
| clock_type::time_point | lastAction_ |
| std::shared_ptr< Ledger > | ledger_ |
| bool | haveHeader_ {false} |
| bool | haveState_ {false} |
| bool | haveTransactions_ {false} |
| bool | signaled_ {false} |
| bool | byHash_ {true} |
| std::uint32_t | seq_ |
| Reason const | reason_ |
| std::set< uint256 > | recentNodes_ |
| SHAMapAddNode | stats_ |
| std::mutex | receivedDataLock_ |
| std::vector< std::pair< std::weak_ptr< Peer >, std::shared_ptr< protocol::TMLedgerData > > > | receivedData_ |
| bool | receiveDispatched_ {false} |
| std::unique_ptr< PeerSet > | peerSet_ |
| boost::asio::basic_waitable_timer< std::chrono::steady_clock > | timer_ |
Definition at line 33 of file InboundLedger.h.
Definition at line 38 of file InboundLedger.h.
| using xrpl::InboundLedger::neededHash_t = std::pair<protocol::TMGetObjectByHash::ObjectType, uint256> |
Definition at line 99 of file InboundLedger.h.
|
protectedinherited |
Definition at line 71 of file TimeoutCounter.h.
|
strong |
| Enumerator | |
|---|---|
| HISTORY | |
| GENERIC | |
| CONSENSUS | |
Definition at line 41 of file InboundLedger.h.
|
strongprivate |
| Enumerator | |
|---|---|
| Added | |
| Reply | |
| Timeout | |
Definition at line 123 of file InboundLedger.h.
| xrpl::InboundLedger::InboundLedger | ( | Application & | app, |
| uint256 const & | hash, | ||
| std::uint32_t | seq, | ||
| Reason | reason, | ||
| clock_type & | clock, | ||
| std::unique_ptr< PeerSet > | peerSet ) |
Definition at line 71 of file InboundLedger.cpp.
|
override |
Definition at line 171 of file InboundLedger.cpp.
| void xrpl::InboundLedger::update | ( | std::uint32_t | seq | ) |
Definition at line 136 of file InboundLedger.cpp.
| bool xrpl::InboundLedger::isComplete | ( | ) | const |
Returns true if we got all the data.
Definition at line 65 of file InboundLedger.h.
| bool xrpl::InboundLedger::isFailed | ( | ) | const |
Returns false if we failed to get the data.
Definition at line 74 of file InboundLedger.h.
| std::shared_ptr< Ledger const > xrpl::InboundLedger::getLedger | ( | ) | const |
Definition at line 80 of file InboundLedger.h.
| std::uint32_t xrpl::InboundLedger::getSeq | ( | ) | const |
Definition at line 86 of file InboundLedger.h.
| bool xrpl::InboundLedger::checkLocal | ( | ) |
Definition at line 149 of file InboundLedger.cpp.
| void xrpl::InboundLedger::init | ( | ScopedLockType & | collectionLock | ) |
Definition at line 94 of file InboundLedger.cpp.
| bool xrpl::InboundLedger::gotData | ( | std::weak_ptr< Peer > | peer, |
| std::shared_ptr< protocol::TMLedgerData > const & | data ) |
Stash a TMLedgerData received from a peer for later processing Returns 'true' if we need to dispatch.
Definition at line 1048 of file InboundLedger.cpp.
| json::Value xrpl::InboundLedger::getJson | ( | int | ) |
Return a json::ValueType::Object.
Definition at line 1303 of file InboundLedger.cpp.
| void xrpl::InboundLedger::runData | ( | ) |
Process pending TMLedgerData Query the a random sample of the 'best' peers.
Definition at line 1256 of file InboundLedger.cpp.
| void xrpl::InboundLedger::touch | ( | ) |
Definition at line 111 of file InboundLedger.h.
| clock_type::time_point xrpl::InboundLedger::getLastAction | ( | ) | const |
Definition at line 117 of file InboundLedger.h.
|
private |
Definition at line 739 of file InboundLedger.cpp.
|
private |
Request more nodes, perhaps from a specific peer.
Definition at line 465 of file InboundLedger.cpp.
|
private |
Definition at line 1012 of file InboundLedger.cpp.
|
private |
Add more peers to the set, if possible.
Definition at line 394 of file InboundLedger.cpp.
|
private |
Definition at line 228 of file InboundLedger.cpp.
|
private |
Definition at line 414 of file InboundLedger.cpp.
|
overrideprivatevirtual |
Called with a lock by the PeerSet when the timer expires.
Implements xrpl::TimeoutCounter.
Definition at line 344 of file InboundLedger.cpp.
|
private |
Definition at line 128 of file InboundLedger.cpp.
|
overrideprivatevirtual |
Return a weak pointer to this.
Implements xrpl::TimeoutCounter.
Definition at line 408 of file InboundLedger.cpp.
|
private |
Process one TMLedgerData Returns the number of useful nodes.
Definition at line 1076 of file InboundLedger.cpp.
|
private |
Take ledger header data Call with a lock.
Definition at line 783 of file InboundLedger.cpp.
|
private |
Process node data received from a peer Call with a lock.
Definition at line 829 of file InboundLedger.cpp.
|
private |
Process AS root node received from a peer Call with a lock.
Definition at line 980 of file InboundLedger.cpp.
|
private |
Process AS root node received from a peer Call with a lock.
Definition at line 944 of file InboundLedger.cpp.
|
private |
Definition at line 214 of file InboundLedger.cpp.
|
private |
Definition at line 220 of file InboundLedger.cpp.
|
virtualinherited |
Cancel the task by marking it as failed if the task is not done.
Definition at line 105 of file TimeoutCounter.cpp.
|
protectedinherited |
Schedule a call to queueJob() after timerInterval_.
Definition at line 40 of file TimeoutCounter.cpp.
|
protectedinherited |
Queue a job to call invokeOnTimer().
Definition at line 58 of file TimeoutCounter.cpp.
|
protectedinherited |
Definition at line 112 of file TimeoutCounter.h.
|
privateinherited |
Calls onTimer() if in the right state.
Only called by queueJob().
Definition at line 80 of file TimeoutCounter.cpp.
|
staticprivatenoexceptinherited |
Definition at line 113 of file CountedObject.h.
|
private |
Definition at line 176 of file InboundLedger.h.
|
private |
Definition at line 177 of file InboundLedger.h.
|
private |
Definition at line 179 of file InboundLedger.h.
|
private |
Definition at line 180 of file InboundLedger.h.
|
private |
Definition at line 181 of file InboundLedger.h.
|
private |
Definition at line 182 of file InboundLedger.h.
|
private |
Definition at line 183 of file InboundLedger.h.
|
private |
Definition at line 184 of file InboundLedger.h.
|
private |
Definition at line 185 of file InboundLedger.h.
|
private |
Definition at line 186 of file InboundLedger.h.
Definition at line 188 of file InboundLedger.h.
|
private |
Definition at line 190 of file InboundLedger.h.
|
private |
Definition at line 193 of file InboundLedger.h.
|
private |
Definition at line 195 of file InboundLedger.h.
|
private |
Definition at line 196 of file InboundLedger.h.
|
private |
Definition at line 197 of file InboundLedger.h.
|
protectedinherited |
Definition at line 119 of file TimeoutCounter.h.
|
protectedinherited |
Definition at line 120 of file TimeoutCounter.h.
|
mutableprotectedinherited |
Definition at line 121 of file TimeoutCounter.h.
|
protectedinherited |
The hash of the object (in practice, always a ledger) we are trying to fetch.
Definition at line 127 of file TimeoutCounter.h.
|
protectedinherited |
Definition at line 128 of file TimeoutCounter.h.
|
protectedinherited |
Definition at line 129 of file TimeoutCounter.h.
|
protectedinherited |
Definition at line 130 of file TimeoutCounter.h.
|
protectedinherited |
Whether forward progress has been made.
Definition at line 134 of file TimeoutCounter.h.
|
protectedinherited |
The minimum time to wait between calls to execute().
Definition at line 138 of file TimeoutCounter.h.
|
protectedinherited |
Definition at line 140 of file TimeoutCounter.h.
|
privateinherited |
Definition at line 150 of file TimeoutCounter.h.
|
inherited |
Definition at line 138 of file CountedObject.h.