| 
    rippled
    
   | 
 
Retains historical ledgers. More...
#include <LedgerHistory.h>

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.   | |
| float | getCacheHitRate () | 
| Get the ledgers_by_hash cache hit rate.   | |
| std::shared_ptr< Ledger const > | getLedgerBySeq (LedgerIndex ledgerIndex) | 
| Get a ledger given its sequence number.   | |
| std::shared_ptr< Ledger const > | getLedgerByHash (LedgerHash const &ledgerHash) | 
| Retrieve a ledger given its hash.   | |
| LedgerHash | getLedgerHash (LedgerIndex ledgerIndex) | 
| Get a ledger's hash given its sequence number.   | |
| void | sweep () | 
| Remove stale cache entries.   | |
| void | builtLedger (std::shared_ptr< Ledger const > const &, uint256 const &consensusHash, Json::Value) | 
| Report that we have locally built a particular ledger.   | |
| void | validatedLedger (std::shared_ptr< Ledger const > const &, std::optional< uint256 > const &consensusHash) | 
| Report that we have validated a particular ledger.   | |
| bool | fixIndex (LedgerIndex ledgerIndex, LedgerHash const &ledgerHash) | 
| Repair a hash to index mapping.   | |
| 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.   | |
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 32 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 55 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 86 of file LedgerHistory.cpp.
| std::shared_ptr< Ledger const > ripple::LedgerHistory::getLedgerByHash | ( | LedgerHash const & | ledgerHash | ) | 
Retrieve a ledger given its hash.
Definition at line 123 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 77 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 451 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 493 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 | 
false if the mapping was repaired Definition at line 536 of file LedgerHistory.cpp.
| void ripple::LedgerHistory::clearLedgerCachePrior | ( | LedgerIndex | seq | ) | 
Definition at line 550 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 339 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.