rippled
|
Retains historical ledgers. More...
Classes | |
struct | cv_entry |
Public Member Functions | |
LedgerHistory (beast::insight::Collector::ptr const &collector, Application &app) | |
bool | insert (std::shared_ptr< Ledger const > const &ledger, bool validated) |
Track a ledger. More... | |
float | getCacheHitRate () |
Get the ledgers_by_hash cache hit rate. More... | |
std::shared_ptr< Ledger const > | getLedgerBySeq (LedgerIndex ledgerIndex) |
Get a ledger given its sequence number. More... | |
std::shared_ptr< Ledger const > | getLedgerByHash (LedgerHash const &ledgerHash) |
Retrieve a ledger given its hash. More... | |
LedgerHash | getLedgerHash (LedgerIndex ledgerIndex) |
Get a ledger's hash given its sequence number. More... | |
void | sweep () |
Remove stale cache entries. More... | |
void | builtLedger (std::shared_ptr< Ledger const > const &, uint256 const &consensusHash, Json::Value) |
Report that we have locally built a particular ledger. More... | |
void | validatedLedger (std::shared_ptr< Ledger const > const &, std::optional< uint256 > const &consensusHash) |
Report that we have validated a particular ledger. More... | |
bool | fixIndex (LedgerIndex ledgerIndex, LedgerHash const &ledgerHash) |
Repair a hash to index mapping. More... | |
void | clearLedgerCachePrior (LedgerIndex seq) |
Private Types | |
using | LedgersByHash = TaggedCache< LedgerHash, Ledger const > |
using | ConsensusValidated = TaggedCache< LedgerIndex, cv_entry > |
Private Member Functions | |
void | handleMismatch (LedgerHash const &built, LedgerHash const &valid, std::optional< uint256 > const &builtConsensusHash, std::optional< uint256 > const &validatedConsensusHash, Json::Value const &consensus) |
Log details in the case where we build one ledger but validate a different one. More... | |
Retains historical ledgers.
Definition at line 36 of file LedgerHistory.h.
|
private |
Definition at line 129 of file LedgerHistory.h.
|
private |
Definition at line 148 of file LedgerHistory.h.
ripple::LedgerHistory::LedgerHistory | ( | beast::insight::Collector::ptr const & | collector, |
Application & | app | ||
) |
Definition at line 31 of file LedgerHistory.cpp.
bool ripple::LedgerHistory::insert | ( | std::shared_ptr< Ledger const > const & | ledger, |
bool | validated | ||
) |
Track a ledger.
true
if the ledger was already tracked Definition at line 54 of file LedgerHistory.cpp.
float ripple::LedgerHistory::getCacheHitRate | ( | ) |
Get the ledgers_by_hash cache hit rate.
Definition at line 53 of file LedgerHistory.h.
std::shared_ptr< Ledger const > ripple::LedgerHistory::getLedgerBySeq | ( | LedgerIndex | ledgerIndex | ) |
Get a ledger given its sequence number.
Definition at line 83 of file LedgerHistory.cpp.
std::shared_ptr< Ledger const > ripple::LedgerHistory::getLedgerByHash | ( | LedgerHash const & | ledgerHash | ) |
Retrieve a ledger given its hash.
Definition at line 116 of file LedgerHistory.cpp.
LedgerHash ripple::LedgerHistory::getLedgerHash | ( | LedgerIndex | ledgerIndex | ) |
Get a ledger's hash given its sequence number.
ledgerIndex | The sequence number of the desired ledger |
Definition at line 74 of file LedgerHistory.cpp.
void ripple::LedgerHistory::sweep | ( | ) |
Remove stale cache entries.
Definition at line 76 of file LedgerHistory.h.
void ripple::LedgerHistory::builtLedger | ( | std::shared_ptr< Ledger const > const & | ledger, |
uint256 const & | consensusHash, | ||
Json::Value | consensus | ||
) |
Report that we have locally built a particular ledger.
Definition at line 426 of file LedgerHistory.cpp.
void ripple::LedgerHistory::validatedLedger | ( | std::shared_ptr< Ledger const > const & | ledger, |
std::optional< uint256 > const & | consensusHash | ||
) |
Report that we have validated a particular ledger.
Definition at line 467 of file LedgerHistory.cpp.
bool ripple::LedgerHistory::fixIndex | ( | LedgerIndex | ledgerIndex, |
LedgerHash const & | ledgerHash | ||
) |
Repair a hash to index mapping.
Ensure m_ledgers_by_hash doesn't have the wrong hash for a particular index.
ledgerIndex | The index whose mapping is to be repaired |
ledgerHash | The hash it is to be mapped to |
true
if the mapping was repaired Definition at line 508 of file LedgerHistory.cpp.
void ripple::LedgerHistory::clearLedgerCachePrior | ( | LedgerIndex | seq | ) |
Definition at line 522 of file LedgerHistory.cpp.
|
private |
Log details in the case where we build one ledger but validate a different one.
built | The hash of the ledger we built |
valid | The hash of the ledger we deemed fully valid |
builtConsensusHash | The hash of the consensus transaction for the ledger we built |
validatedConsensusHash | The hash of the validated ledger's consensus transaction set |
consensus | The status of the consensus round |
Definition at line 318 of file LedgerHistory.cpp.
|
private |
Definition at line 125 of file LedgerHistory.h.
|
private |
Definition at line 126 of file LedgerHistory.h.
|
private |
Definition at line 127 of file LedgerHistory.h.
|
private |
Definition at line 131 of file LedgerHistory.h.
|
private |
Definition at line 149 of file LedgerHistory.h.
|
private |
Definition at line 152 of file LedgerHistory.h.
|
private |
Definition at line 154 of file LedgerHistory.h.