rippled
|
Public Types | |
enum | Reason { Reason::HISTORY, Reason::SHARD, Reason::GENERIC, Reason::CONSENSUS } |
using | clock_type = beast::abstract_clock< 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 () | |
void | update (std::uint32_t seq) |
bool | isComplete () const |
Returns true if we got all the data. More... | |
bool | isFailed () const |
Returns false if we failed to get the data. More... | |
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. More... | |
Json::Value | getJson (int) |
Return a Json::objectValue. More... | |
void | runData () |
Process pending TMLedgerData Query the a random sample of the 'best' peers. More... | |
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. More... | |
T | shared_from_this (T... args) |
T | weak_from_this (T... args) |
Protected Types | |
using | ScopedLockType = std::unique_lock< std::recursive_mutex > |
Protected Member Functions | |
void | setTimer (ScopedLockType &) |
Schedule a call to queueJob() after mTimerInterval. More... | |
void | queueJob (ScopedLockType &) |
Queue a job to call invokeOnTimer(). More... | |
bool | isDone () const |
Protected Attributes | |
Application & | app_ |
beast::Journal | journal_ |
std::recursive_mutex | mtx_ |
const uint256 | hash_ |
The hash of the object (in practice, always a ledger) we are trying to fetch. More... | |
int | timeouts_ |
bool | complete_ |
bool | failed_ |
bool | progress_ |
Whether forward progress has been made. More... | |
std::chrono::milliseconds | timerInterval_ |
The minimum time to wait between calls to execute(). More... | |
QueueJobParameter | queueJobParameter_ |
Private Types | |
enum | TriggerReason { TriggerReason::added, TriggerReason::reply, TriggerReason::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. More... | |
std::vector< neededHash_t > | getNeededHashes () |
void | addPeers () |
Add more peers to the set, if possible. More... | |
void | tryDB (NodeStore::Database &srcDB) |
void | done () |
void | onTimer (bool progress, ScopedLockType &peerSetLock) override |
Called with a lock by the PeerSet when the timer expires. More... | |
std::size_t | getPeerCount () const |
std::weak_ptr< TimeoutCounter > | pmDowncast () override |
Return a weak pointer to this. More... | |
int | processData (std::shared_ptr< Peer > peer, protocol::TMLedgerData &data) |
Process one TMLedgerData Returns the number of useful nodes. More... | |
bool | takeHeader (std::string const &data) |
Take ledger header data Call with a lock. More... | |
void | receiveNode (protocol::TMLedgerData &packet, SHAMapAddNode &) |
Process node data received from a peer Call with a lock. More... | |
bool | takeTxRootNode (Slice const &data, SHAMapAddNode &) |
Process AS root node received from a peer Call with a lock. More... | |
bool | takeAsRootNode (Slice const &data, SHAMapAddNode &) |
Process AS root node received from a peer Call with a lock. More... | |
std::vector< uint256 > | neededTxHashes (int max, SHAMapSyncFilter *filter) const |
std::vector< uint256 > | neededStateHashes (int max, SHAMapSyncFilter *filter) const |
void | invokeOnTimer () |
Calls onTimer() if in the right state. More... | |
Static Private Member Functions | |
static auto & | getCounter () noexcept |
Private Attributes | |
clock_type & | m_clock |
clock_type::time_point | mLastAction |
std::shared_ptr< Ledger > | mLedger |
bool | mHaveHeader |
bool | mHaveState |
bool | mHaveTransactions |
bool | mSignaled |
bool | mByHash |
std::uint32_t | mSeq |
const Reason | mReason |
std::set< uint256 > | mRecentNodes |
SHAMapAddNode | mStats |
std::mutex | mReceivedDataLock |
std::vector< std::pair< std::weak_ptr< Peer >, std::shared_ptr< protocol::TMLedgerData > > > | mReceivedData |
bool | mReceiveDispatched |
std::unique_ptr< PeerSet > | mPeerSet |
boost::asio::basic_waitable_timer< std::chrono::steady_clock > | timer_ |
Definition at line 35 of file InboundLedger.h.
Definition at line 40 of file InboundLedger.h.
using ripple::InboundLedger::neededHash_t = std::pair<protocol::TMGetObjectByHash::ObjectType, uint256> |
Definition at line 101 of file InboundLedger.h.
|
protectedinherited |
Definition at line 81 of file TimeoutCounter.h.
|
strong |
Enumerator | |
---|---|
HISTORY | |
SHARD | |
GENERIC | |
CONSENSUS |
Definition at line 43 of file InboundLedger.h.
|
strongprivate |
Enumerator | |
---|---|
added | |
reply | |
timeout |
Definition at line 123 of file InboundLedger.h.
ripple::InboundLedger::InboundLedger | ( | Application & | app, |
uint256 const & | hash, | ||
std::uint32_t | seq, | ||
Reason | reason, | ||
clock_type & | clock, | ||
std::unique_ptr< PeerSet > | peerSet | ||
) |
Definition at line 77 of file InboundLedger.cpp.
ripple::InboundLedger::~InboundLedger | ( | ) |
Definition at line 216 of file InboundLedger.cpp.
void ripple::InboundLedger::update | ( | std::uint32_t | seq | ) |
Definition at line 183 of file InboundLedger.cpp.
bool ripple::InboundLedger::isComplete | ( | ) | const |
Returns true if we got all the data.
Definition at line 66 of file InboundLedger.h.
bool ripple::InboundLedger::isFailed | ( | ) | const |
Returns false if we failed to get the data.
Definition at line 73 of file InboundLedger.h.
std::shared_ptr<Ledger const> ripple::InboundLedger::getLedger | ( | ) | const |
Definition at line 79 of file InboundLedger.h.
std::uint32_t ripple::InboundLedger::getSeq | ( | ) | const |
Definition at line 85 of file InboundLedger.h.
bool ripple::InboundLedger::checkLocal | ( | ) |
Definition at line 196 of file InboundLedger.cpp.
void ripple::InboundLedger::init | ( | ScopedLockType & | collectionLock | ) |
Definition at line 106 of file InboundLedger.cpp.
bool ripple::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 1105 of file InboundLedger.cpp.
Json::Value ripple::InboundLedger::getJson | ( | int | ) |
Return a Json::objectValue.
Definition at line 1359 of file InboundLedger.cpp.
void ripple::InboundLedger::runData | ( | ) |
Process pending TMLedgerData Query the a random sample of the 'best' peers.
Definition at line 1312 of file InboundLedger.cpp.
void ripple::InboundLedger::touch | ( | ) |
Definition at line 111 of file InboundLedger.h.
clock_type::time_point ripple::InboundLedger::getLastAction | ( | ) | const |
Definition at line 117 of file InboundLedger.h.
|
private |
Definition at line 834 of file InboundLedger.cpp.
|
private |
Request more nodes, perhaps from a specific peer.
Definition at line 557 of file InboundLedger.cpp.
|
private |
Definition at line 1065 of file InboundLedger.cpp.
|
private |
Add more peers to the set, if possible.
Definition at line 483 of file InboundLedger.cpp.
|
private |
Definition at line 307 of file InboundLedger.cpp.
|
private |
Definition at line 503 of file InboundLedger.cpp.
|
overrideprivatevirtual |
Called with a lock by the PeerSet when the timer expires.
Implements ripple::TimeoutCounter.
Definition at line 432 of file InboundLedger.cpp.
|
private |
Definition at line 174 of file InboundLedger.cpp.
|
overrideprivatevirtual |
Return a weak pointer to this.
Implements ripple::TimeoutCounter.
Definition at line 497 of file InboundLedger.cpp.
|
private |
Process one TMLedgerData Returns the number of useful nodes.
Definition at line 1132 of file InboundLedger.cpp.
|
private |
Take ledger header data Call with a lock.
Definition at line 880 of file InboundLedger.cpp.
|
private |
Process node data received from a peer Call with a lock.
Definition at line 928 of file InboundLedger.cpp.
|
private |
Process AS root node received from a peer Call with a lock.
Definition at line 1043 of file InboundLedger.cpp.
|
private |
Process AS root node received from a peer Call with a lock.
Definition at line 1018 of file InboundLedger.cpp.
|
private |
Definition at line 262 of file InboundLedger.cpp.
|
private |
Definition at line 268 of file InboundLedger.cpp.
|
virtualinherited |
Cancel the task by marking it as failed if the task is not done.
Definition at line 118 of file TimeoutCounter.cpp.
|
protectedinherited |
Schedule a call to queueJob() after mTimerInterval.
Definition at line 50 of file TimeoutCounter.cpp.
|
protectedinherited |
Queue a job to call invokeOnTimer().
Definition at line 69 of file TimeoutCounter.cpp.
|
protectedinherited |
Definition at line 116 of file TimeoutCounter.h.
|
privateinherited |
Calls onTimer() if in the right state.
Only called by queueJob().
Definition at line 93 of file TimeoutCounter.cpp.
|
staticprivatenoexceptinherited |
Definition at line 128 of file CountedObject.h.
|
private |
Definition at line 175 of file InboundLedger.h.
|
private |
Definition at line 176 of file InboundLedger.h.
|
private |
Definition at line 178 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.
Definition at line 187 of file InboundLedger.h.
|
private |
Definition at line 189 of file InboundLedger.h.
|
private |
Definition at line 192 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 123 of file TimeoutCounter.h.
|
protectedinherited |
Definition at line 124 of file TimeoutCounter.h.
|
mutableprotectedinherited |
Definition at line 125 of file TimeoutCounter.h.
|
protectedinherited |
The hash of the object (in practice, always a ledger) we are trying to fetch.
Definition at line 129 of file TimeoutCounter.h.
|
protectedinherited |
Definition at line 130 of file TimeoutCounter.h.
|
protectedinherited |
Definition at line 131 of file TimeoutCounter.h.
|
protectedinherited |
Definition at line 132 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 136 of file TimeoutCounter.h.
|
protectedinherited |
Definition at line 138 of file TimeoutCounter.h.
|
privateinherited |
Definition at line 147 of file TimeoutCounter.h.