1#ifndef XRPL_APP_LEDGER_LEDGERMASTER_H_INCLUDED 
    2#define XRPL_APP_LEDGER_LEDGERMASTER_H_INCLUDED 
    4#include <xrpld/app/ledger/AbstractFetchPackContainer.h> 
    5#include <xrpld/app/ledger/InboundLedgers.h> 
    6#include <xrpld/app/ledger/Ledger.h> 
    7#include <xrpld/app/ledger/LedgerHistory.h> 
    8#include <xrpld/app/ledger/LedgerHolder.h> 
    9#include <xrpld/app/ledger/LedgerReplay.h> 
   10#include <xrpld/app/main/Application.h> 
   11#include <xrpld/app/misc/CanonicalTXSet.h> 
   13#include <xrpl/basics/RangeSet.h> 
   14#include <xrpl/basics/UptimeClock.h> 
   15#include <xrpl/basics/chrono.h> 
   16#include <xrpl/beast/insight/Collector.h> 
   17#include <xrpl/protocol/Protocol.h> 
   18#include <xrpl/protocol/RippleLedgerHash.h> 
   19#include <xrpl/protocol/messages.h> 
  375        template <
class Handler>
 
  377            Handler 
const& handler,
 
  379            : 
hook(collector->make_hook(handler))
 
  381                  collector->make_gauge(
"LedgerMaster", 
"Validated_Ledger_Age"))
 
  383                  collector->make_gauge(
"LedgerMaster", 
"Published_Ledger_Age"))
 
 
 
 
Provide a light-weight way to check active() before string formatting.
 
A generic endpoint for log messages.
 
typename Clock::time_point time_point
 
A metric for measuring an integral value.
 
void set(value_type value) const
Set the value on the gauge.
 
A reference to a handler for performing polled collection.
 
An interface facilitating retrieval of fetch packs without an application or ledgermaster object.
 
Holds transactions which were deferred to the next pass of consensus.
 
Retains historical ledgers.
 
Hold a ledger in a thread-safe way.
 
std::shared_ptr< Ledger const > get()
 
bool haveLedger(std::uint32_t seq)
 
std::shared_ptr< Ledger const > getValidatedLedger()
 
void clearLedgerCachePrior(LedgerIndex seq)
 
RangeSet< std::uint32_t > mCompleteLedgers
 
void setBuildingLedger(LedgerIndex index)
 
std::unique_ptr< LedgerReplay > releaseReplay()
 
void failedSave(std::uint32_t seq, uint256 const &hash)
 
void takeReplay(std::unique_ptr< LedgerReplay > replay)
 
std::uint32_t const ledger_history_
 
void addHeldTransaction(std::shared_ptr< Transaction > const &trans)
 
void checkAccept(std::shared_ptr< Ledger const > const &ledger)
 
std::optional< NetClock::time_point > getCloseTimeByHash(LedgerHash const &ledgerHash, LedgerIndex ledgerIndex)
 
std::size_t getNeededValidations()
Determines how many validations are needed to fully validate a ledger.
 
std::unique_ptr< LedgerReplay > replayData
 
bool haveValidated()
Whether we have ever fully validated a ledger.
 
void setLedgerRangePresent(std::uint32_t minV, std::uint32_t maxV)
 
TimeKeeper::time_point upgradeWarningPrevTime_
 
LedgerHistory mLedgerHistory
 
std::optional< NetClock::time_point > getCloseTimeBySeq(LedgerIndex ledgerIndex)
 
void fixMismatch(ReadView const &ledger)
 
std::atomic< LedgerIndex > mPubLedgerSeq
 
void clearPriorLedgers(LedgerIndex seq)
 
std::shared_ptr< Ledger const  > mPubLedger
 
void makeFetchPack(std::weak_ptr< Peer > const &wPeer, std::shared_ptr< protocol::TMGetObjectByHash > const &request, uint256 haveLedgerHash, UptimeClock::time_point uptime)
 
std::atomic< LedgerIndex > mBuildingLedgerSeq
 
std::shared_ptr< ReadView const > getCurrentLedger()
 
void tryFill(std::shared_ptr< Ledger const > ledger)
 
std::uint32_t const fetch_depth_
 
bool canBeCurrent(std::shared_ptr< Ledger const > const &ledger)
Check the sequence number and parent close time of a ledger against our clock and last validated ledg...
 
bool isValidated(ReadView const &ledger)
 
std::uint32_t getEarliestFetch()
 
std::recursive_mutex m_mutex
 
std::optional< LedgerHash > walkHashBySeq(std::uint32_t index, InboundLedger::Reason reason)
Walk to a ledger's hash using the skip list.
 
uint256 getHashBySeq(std::uint32_t index)
Get a ledger's hash by sequence number using the cache.
 
std::shared_ptr< STTx const > popAcctTransaction(std::shared_ptr< STTx const > const &tx)
Get the next transaction held for a particular account if any.
 
LedgerIndex const max_ledger_difference_
 
bool fixIndex(LedgerIndex ledgerIndex, LedgerHash const &ledgerHash)
 
TaggedCache< uint256, Blob > fetch_packs_
 
bool newPFWork(char const *name, std::unique_lock< std::recursive_mutex > &)
A thread needs to be dispatched to handle pathfinding work of some kind.
 
bool isCaughtUp(std::string &reason)
 
void setPubLedger(std::shared_ptr< Ledger const > const &l)
 
std::optional< uint256 > txnIdFromIndex(uint32_t ledgerSeq, uint32_t txnIndex)
 
bool getValidatedRange(std::uint32_t &minVal, std::uint32_t &maxVal)
 
void clearLedger(std::uint32_t seq)
 
std::pair< uint256, LedgerIndex > mLastValidLedger
 
std::shared_ptr< Ledger const > getClosedLedger()
 
std::optional< LedgerIndex > minSqlSeq()
 
void setFullLedger(std::shared_ptr< Ledger const > const &ledger, bool isSynchronous, bool isCurrent)
 
std::atomic< std::uint32_t > mValidLedgerSign
 
virtual ~LedgerMaster()=default
 
CanonicalTXSet mHeldTransactions
 
std::uint32_t const ledger_fetch_size_
 
void applyHeldTransactions()
Apply held transactions to the open ledger This is normally called as we close the ledger.
 
std::chrono::seconds getPublishedLedgerAge()
 
std::shared_ptr< Ledger const  > mHistLedger
 
std::recursive_mutex mCompleteLock
 
std::string getCompleteLedgers()
 
std::atomic< LedgerIndex > mValidLedgerSeq
 
std::size_t getFetchPackCacheSize() const
 
bool getFullValidatedRange(std::uint32_t &minVal, std::uint32_t &maxVal)
 
std::optional< Blob > getFetchPack(uint256 const &hash) override
Retrieves partial ledger data of the coresponding hash from peers.
 
void gotFetchPack(bool progress, std::uint32_t seq)
 
std::recursive_mutex & peekMutex()
 
void consensusBuilt(std::shared_ptr< Ledger const > const &ledger, uint256 const &consensusHash, Json::Value consensus)
Report that the consensus process built a particular ledger.
 
Rules getValidatedRules()
 
std::shared_ptr< Ledger const  > mPathLedger
 
void setValidLedger(std::shared_ptr< Ledger const > const &l)
 
std::optional< LedgerHash > getLedgerHashForHistory(LedgerIndex index, InboundLedger::Reason reason)
 
void addFetchPack(uint256 const &hash, std::shared_ptr< Blob > data)
 
std::atomic< std::uint32_t > mPubLedgerClose
 
void switchLCL(std::shared_ptr< Ledger const > const &lastClosed)
 
LedgerHolder mValidLedger
 
std::shared_ptr< ReadView const > getPublishedLedger()
 
std::atomic_flag mGotFetchPackThread
 
void doAdvance(std::unique_lock< std::recursive_mutex > &)
 
LedgerHolder mClosedLedger
 
bool storeLedger(std::shared_ptr< Ledger const > ledger)
 
std::vector< std::shared_ptr< Ledger const > > findNewLedgersToPublish(std::unique_lock< std::recursive_mutex > &)
 
LedgerIndex getCurrentLedgerIndex()
 
bool isCompatible(ReadView const &, beast::Journal::Stream, char const *reason)
 
std::shared_ptr< Ledger const > getLedgerBySeq(std::uint32_t index)
 
void fetchForHistory(std::uint32_t missing, bool &progress, InboundLedger::Reason reason, std::unique_lock< std::recursive_mutex > &)
 
std::shared_ptr< Ledger const > getLedgerByHash(uint256 const &hash)
 
LedgerIndex getValidLedgerIndex()
 
std::chrono::seconds getValidatedLedgerAge()
 
Rules controlling protocol behavior.
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
bool isCurrent(ValidationParms const &p, NetClock::time_point now, NetClock::time_point signTime, NetClock::time_point seenTime)
Whether a validation is still current.
 
boost::icl::interval_set< T, std::less, ClosedInterval< T > > RangeSet
A set of closed intervals over the domain T.
 
Stopwatch & stopwatch()
Returns an instance of a wall clock.
 
beast::insight::Gauge publishedLedgerAge
 
beast::insight::Gauge validatedLedgerAge
 
beast::insight::Hook hook
 
Stats(Handler const &handler, beast::insight::Collector::ptr const &collector)