rippled
LedgerMaster.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #ifndef RIPPLE_APP_LEDGER_LEDGERMASTER_H_INCLUDED
21 #define RIPPLE_APP_LEDGER_LEDGERMASTER_H_INCLUDED
22 
23 #include <ripple/app/ledger/AbstractFetchPackContainer.h>
24 #include <ripple/app/ledger/InboundLedgers.h>
25 #include <ripple/app/ledger/Ledger.h>
26 #include <ripple/app/ledger/LedgerHistory.h>
27 #include <ripple/app/ledger/LedgerHolder.h>
28 #include <ripple/app/ledger/LedgerReplay.h>
29 #include <ripple/app/main/Application.h>
30 #include <ripple/app/misc/CanonicalTXSet.h>
31 #include <ripple/basics/RangeSet.h>
32 #include <ripple/basics/StringUtilities.h>
33 #include <ripple/basics/UptimeClock.h>
34 #include <ripple/basics/chrono.h>
35 #include <ripple/beast/insight/Collector.h>
36 #include <ripple/protocol/Protocol.h>
37 #include <ripple/protocol/RippleLedgerHash.h>
38 #include <ripple/protocol/STValidation.h>
39 #include <ripple/protocol/messages.h>
40 #include <optional>
41 
42 #include <mutex>
43 
44 namespace ripple {
45 
46 class Peer;
47 class Transaction;
48 
49 // This error is thrown when a codepath tries to access the open or closed
50 // ledger while the server is running in reporting mode. Any RPCs that request
51 // the open or closed ledger should be forwarded to a p2p node. Usually, the
52 // decision to forward is made based on the required condition of the handler,
53 // or which ledger is specified. However, there are some codepaths which are not
54 // covered by the aforementioned logic (though they probably should), so this
55 // error is thrown in case a codepath falls through the cracks.
57 {
58 public:
60  : std::runtime_error(
61  "Reporting mode has no open or closed ledger. Proxy this "
62  "request")
63  {
64  }
65 };
66 
67 // Tracks the current ledger and any ledgers in the process of closing
68 // Tracks ledger history
69 // Tracks held transactions
71 {
72 public:
73  explicit LedgerMaster(
74  Application& app,
76  beast::insight::Collector::ptr const& collector,
77  beast::Journal journal);
78 
79  virtual ~LedgerMaster() = default;
80 
85 
86  bool
87  isCompatible(ReadView const&, beast::Journal::Stream, char const* reason);
88 
90  peekMutex();
91 
92  // The current ledger is the ledger we believe new transactions should go in
95 
96  // The finalized ledger is the last closed/accepted ledger
99  {
100  if (app_.config().reporting())
101  {
102  Throw<ReportingShouldProxy>();
103  }
104  return mClosedLedger.get();
105  }
106 
107  // The validated ledger is the last fully validated ledger.
110 
111  // The Rules are in the last fully validated ledger if there is one.
112  Rules
114 
115  // This is the last ledger we published to clients and can lag the validated
116  // ledger
119 
124  bool
125  isCaughtUp(std::string& reason);
126 
129 
130  bool
132 
133  void
135  std::shared_ptr<Ledger const> const& ledger,
136  bool isSynchronous,
137  bool isCurrent);
138 
143  bool
145 
146  void
147  switchLCL(std::shared_ptr<Ledger const> const& lastClosed);
148 
149  void
150  failedSave(std::uint32_t seq, uint256 const& hash);
151 
154 
160  void
162 
170 
173  uint256
175 
179 
189  std::uint32_t index,
190  std::shared_ptr<ReadView const> const& referenceLedger,
191  InboundLedger::Reason reason);
192 
195 
197  getLedgerByHash(uint256 const& hash);
198 
199  void
201 
203  getCloseTimeBySeq(LedgerIndex ledgerIndex);
204 
206  getCloseTimeByHash(LedgerHash const& ledgerHash, LedgerIndex ledgerIndex);
207 
208  void
210  void
211  fixMismatch(ReadView const& ledger);
212 
213  bool
215  void
217  bool
218  isValidated(ReadView const& ledger);
219  bool
221  bool
223 
224  void
225  sweep();
226  float
227  getCacheHitRate();
228 
229  void
231  void
232  checkAccept(uint256 const& hash, std::uint32_t seq);
233  void
235  std::shared_ptr<Ledger const> const& ledger,
236  uint256 const& consensusHash,
237  Json::Value consensus);
238 
239  void
241 
242  void
243  tryAdvance();
244  bool
245  newPathRequest(); // Returns true if path request successfully placed.
246  bool
248  bool
249  newOrderBookDB(); // Returns true if able to fulfill request.
250 
251  bool
252  fixIndex(LedgerIndex ledgerIndex, LedgerHash const& ledgerHash);
253 
254  void
256 
257  void
259 
260  // ledger replay
261  void
264  releaseReplay();
265 
266  // Fetch Packs
267  void
268  gotFetchPack(bool progress, std::uint32_t seq);
269 
270  void
271  addFetchPack(uint256 const& hash, std::shared_ptr<Blob> data);
272 
274  getFetchPack(uint256 const& hash) override;
275 
276  void
278  std::weak_ptr<Peer> const& wPeer,
280  uint256 haveLedgerHash,
281  UptimeClock::time_point uptime);
282 
284  getFetchPackCacheSize() const;
285 
287  bool
289  {
290  return !mValidLedger.empty();
291  }
292 
293  // Returns the minimum ledger sequence in SQL database, if any.
295  minSqlSeq();
296 
298  bool
299  standalone() const
300  {
301  return standalone_;
302  }
303 
310  template <class Rep, class Period>
311  void
313  {
315  validCond_.wait_for(lock, dur);
316  }
317 
318  // Iff a txn exists at the specified ledger and offset then return its txnid
320  txnIdFromIndex(uint32_t ledgerSeq, uint32_t txnIndex);
321 
322 private:
323  void
325  void
327 
328  void
330 
331  void
333 
336 
339  void
341  std::uint32_t missing,
342  bool& progress,
343  InboundLedger::Reason reason,
345  // Try to publish ledgers, acquire missing ledgers. Always called with
346  // m_mutex locked. The passed lock is a reminder to callers.
347  void
349 
352 
353  void
354  updatePaths();
355 
356  // Returns true if work started. Always called with m_mutex locked.
357  // The passed lock is a reminder to callers.
358  bool
360 
363 
365 
366  // The ledger that most recently closed.
368 
369  // The highest-sequence ledger we have fully accepted.
371 
372  // The last ledger we have published.
374 
375  // The last ledger we did pathfinding against.
377 
378  // The last ledger we handled fetching history
380 
381  // The last ledger we handled fetching for a shard
383 
384  // Fully validated ledger, whether or not we have the ledger resident.
386 
388 
390 
391  // A set of transactions to replay during the next close
393 
396 
397  // Publish thread is running.
398  bool mAdvanceThread{false};
399 
400  // Publish thread has work to do.
401  bool mAdvanceWork{false};
403 
404  int mPathFindThread{0}; // Pathfinder jobs dispatched
405  bool mPathFindNewRequest{false};
406 
408  ATOMIC_FLAG_INIT; // GotFetchPack jobs dispatched
409 
415 
416  // The server is in standalone mode
417  bool const standalone_;
418 
419  // How many ledgers before the current ledger do we allow peers to request?
421 
422  // How much history do we want to keep
424 
426 
428 
430 
431  // Try to keep a validator from switching from test to live network
432  // without first wiping the database.
434 
435  // Time that the previous upgrade warning was issued.
437 
438  // mutex and condition variable for waiting for next validated ledger
441 
442  struct Stats
443  {
444  template <class Handler>
446  Handler const& handler,
447  beast::insight::Collector::ptr const& collector)
448  : hook(collector->make_hook(handler))
450  collector->make_gauge("LedgerMaster", "Validated_Ledger_Age"))
452  collector->make_gauge("LedgerMaster", "Published_Ledger_Age"))
453  {
454  }
455 
459  };
460 
462 
463  void
465  {
466  std::lock_guard lock(m_mutex);
469  }
470 };
471 
472 } // namespace ripple
473 
474 #endif
ripple::LedgerMaster::standalone
bool standalone() const
Whether we are in standalone mode.
Definition: LedgerMaster.h:299
ripple::LedgerMaster::getValidatedRange
bool getValidatedRange(std::uint32_t &minVal, std::uint32_t &maxVal)
Definition: LedgerMaster.cpp:683
ripple::LedgerMaster::mPubLedger
std::shared_ptr< Ledger const > mPubLedger
Definition: LedgerMaster.h:373
ripple::LedgerMaster::validCond_
std::condition_variable validCond_
Definition: LedgerMaster.h:440
ripple::Application
Definition: Application.h:116
ripple::LedgerMaster::mClosedLedger
LedgerHolder mClosedLedger
Definition: LedgerMaster.h:367
ripple::LedgerMaster::getPublishedLedger
std::shared_ptr< ReadView const > getPublishedLedger()
Definition: LedgerMaster.cpp:1747
ripple::LedgerMaster::fetch_packs_
TaggedCache< uint256, Blob > fetch_packs_
Definition: LedgerMaster.h:427
ripple::LedgerMaster::makeFetchPack
void makeFetchPack(std::weak_ptr< Peer > const &wPeer, std::shared_ptr< protocol::TMGetObjectByHash > const &request, uint256 haveLedgerHash, UptimeClock::time_point uptime)
Definition: LedgerMaster.cpp:2282
ripple::LedgerMaster::clearLedgerCachePrior
void clearLedgerCachePrior(LedgerIndex seq)
Definition: LedgerMaster.cpp:1948
std::string
STL class.
std::shared_ptr< Collector >
ripple::TaggedCache
Map/cache combination.
Definition: Application.h:64
ripple::LedgerMaster::sweep
void sweep()
Definition: LedgerMaster.cpp:1927
ripple::LedgerMaster::mBuildingLedgerSeq
std::atomic< LedgerIndex > mBuildingLedgerSeq
Definition: LedgerMaster.h:414
ripple::LedgerMaster::app_
Application & app_
Definition: LedgerMaster.h:361
ripple::LedgerMaster::Stats::Stats
Stats(Handler const &handler, beast::insight::Collector::ptr const &collector)
Definition: LedgerMaster.h:445
ripple::LedgerMaster::mLedgerHistory
LedgerHistory mLedgerHistory
Definition: LedgerMaster.h:387
ripple::LedgerMaster::mHeldTransactions
CanonicalTXSet mHeldTransactions
Definition: LedgerMaster.h:389
std::pair
ripple::LedgerMaster
Definition: LedgerMaster.h:70
ripple::LedgerMaster::getValidLedgerIndex
LedgerIndex getValidLedgerIndex()
Definition: LedgerMaster.cpp:213
std::vector
STL class.
ripple::LedgerMaster::mHistLedger
std::shared_ptr< Ledger const > mHistLedger
Definition: LedgerMaster.h:379
ripple::LedgerMaster::Stats::hook
beast::insight::Hook hook
Definition: LedgerMaster.h:456
ripple::LedgerMaster::getPublishedLedgerAge
std::chrono::seconds getPublishedLedgerAge()
Definition: LedgerMaster.cpp:250
ripple::LedgerMaster::upgradeWarningPrevTime_
TimeKeeper::time_point upgradeWarningPrevTime_
Definition: LedgerMaster.h:436
ripple::LedgerMaster::releaseReplay
std::unique_ptr< LedgerReplay > releaseReplay()
Definition: LedgerMaster.cpp:1960
std::chrono::seconds
ripple::LedgerMaster::getValidatedRules
Rules getValidatedRules()
Definition: LedgerMaster.cpp:1732
ripple::LedgerMaster::mCompleteLock
std::recursive_mutex mCompleteLock
Definition: LedgerMaster.h:394
ripple::LedgerMaster::applyHeldTransactions
void applyHeldTransactions()
Apply held transactions to the open ledger This is normally called as we close the ledger.
Definition: LedgerMaster.cpp:551
ripple::LedgerMaster::switchLCL
void switchLCL(std::shared_ptr< Ledger const > const &lastClosed)
Definition: LedgerMaster.cpp:506
std::recursive_mutex
STL class.
ripple::LedgerMaster::newPFWork
bool newPFWork(const char *name, std::unique_lock< std::recursive_mutex > &)
A thread needs to be dispatched to handle pathfinding work of some kind.
Definition: LedgerMaster.cpp:1678
std::lock_guard
STL class.
ripple::LedgerMaster::getLedgerByHash
std::shared_ptr< Ledger const > getLedgerByHash(uint256 const &hash)
Definition: LedgerMaster.cpp:1907
ripple::LedgerMaster::isNewPathRequest
bool isNewPathRequest()
Definition: LedgerMaster.cpp:1656
ripple::stopwatch
Stopwatch & stopwatch()
Returns an instance of a wall clock.
Definition: chrono.h:120
ripple::LedgerMaster::getEarliestFetch
std::uint32_t getEarliestFetch()
Definition: LedgerMaster.cpp:750
ripple::LedgerHistory
Retains historical ledgers.
Definition: LedgerHistory.h:36
ripple::LedgerMaster::walkHashBySeq
std::optional< LedgerHash > walkHashBySeq(std::uint32_t index, InboundLedger::Reason reason)
Walk to a ledger's hash using the skip list.
Definition: LedgerMaster.cpp:1807
ripple::LedgerMaster::setFullLedger
void setFullLedger(std::shared_ptr< Ledger const > const &ledger, bool isSynchronous, bool isCurrent)
Definition: LedgerMaster.cpp:964
std::atomic_flag
ripple::LedgerMaster::fixMismatch
void fixMismatch(ReadView const &ledger)
Definition: LedgerMaster.cpp:909
ripple::LedgerMaster::fetch_depth_
const std::uint32_t fetch_depth_
Definition: LedgerMaster.h:420
ripple::CanonicalTXSet
Holds transactions which were deferred to the next pass of consensus.
Definition: CanonicalTXSet.h:38
ripple::LedgerMaster::getCompleteLedgers
std::string getCompleteLedgers()
Definition: LedgerMaster.cpp:1754
ripple::LedgerMaster::ledger_fetch_size_
const std::uint32_t ledger_fetch_size_
Definition: LedgerMaster.h:425
ripple::LedgerMaster::Stats::validatedLedgerAge
beast::insight::Gauge validatedLedgerAge
Definition: LedgerMaster.h:457
ripple::uint256
base_uint< 256 > uint256
Definition: base_uint.h:550
ripple::LedgerMaster::peekMutex
std::recursive_mutex & peekMutex()
Definition: LedgerMaster.cpp:1700
ripple::LedgerMaster::mGotFetchPackThread
std::atomic_flag mGotFetchPackThread
Definition: LedgerMaster.h:407
ripple::base_uint< 256 >
ripple::LedgerMaster::mCompleteLedgers
RangeSet< std::uint32_t > mCompleteLedgers
Definition: LedgerMaster.h:395
ripple::Config::reporting
bool reporting() const
Definition: Config.h:351
ripple::LedgerMaster::mFillInProgress
int mFillInProgress
Definition: LedgerMaster.h:402
ripple::LedgerMaster::replayData
std::unique_ptr< LedgerReplay > replayData
Definition: LedgerMaster.h:392
ripple::LedgerMaster::gotFetchPack
void gotFetchPack(bool progress, std::uint32_t seq)
Definition: LedgerMaster.cpp:2212
ripple::LedgerMaster::fetchForHistory
void fetchForHistory(std::uint32_t missing, bool &progress, InboundLedger::Reason reason, std::unique_lock< std::recursive_mutex > &)
Definition: LedgerMaster.cpp:1966
ripple::LedgerMaster::getFetchPack
std::optional< Blob > getFetchPack(uint256 const &hash) override
Retrieves partial ledger data of the coresponding hash from peers.
Definition: LedgerMaster.cpp:2199
ripple::LedgerMaster::failedSave
void failedSave(std::uint32_t seq, uint256 const &hash)
Definition: LedgerMaster.cpp:1025
ripple::LedgerHolder::empty
bool empty()
Definition: LedgerHolder.h:63
ripple::LedgerMaster::getFullValidatedRange
bool getFullValidatedRange(std::uint32_t &minVal, std::uint32_t &maxVal)
Definition: LedgerMaster.cpp:656
ripple::Application::config
virtual Config & config()=0
ripple::LedgerMaster::fixIndex
bool fixIndex(LedgerIndex ledgerIndex, LedgerHash const &ledgerHash)
Definition: LedgerMaster.cpp:532
ripple::isCurrent
bool isCurrent(ValidationParms const &p, NetClock::time_point now, NetClock::time_point signTime, NetClock::time_point seenTime)
Whether a validation is still current.
Definition: Validations.h:148
std::unique_lock
STL class.
ripple::LedgerMaster::canBeCurrent
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...
Definition: LedgerMaster.cpp:438
ripple::AbstractFetchPackContainer
An interface facilitating retrieval of fetch packs without an application or ledgermaster object.
Definition: AbstractFetchPackContainer.h:32
ripple::LedgerMaster::haveLedger
bool haveLedger(std::uint32_t seq)
Definition: LedgerMaster.cpp:593
beast::Journal::Stream
Provide a light-weight way to check active() before string formatting.
Definition: Journal.h:193
ripple::LedgerMaster::isCompatible
bool isCompatible(ReadView const &, beast::Journal::Stream, char const *reason)
Definition: LedgerMaster.cpp:219
std::chrono::time_point
ripple::LedgerMaster::minSqlSeq
std::optional< LedgerIndex > minSqlSeq()
Definition: LedgerMaster.cpp:2420
ripple::LedgerMaster::updatePaths
void updatePaths()
Definition: LedgerMaster.cpp:1544
ripple::LedgerMaster::getLedgerBySeq
std::shared_ptr< Ledger const > getLedgerBySeq(std::uint32_t index)
Definition: LedgerMaster.cpp:1871
ripple::LedgerMaster::txnIdFromIndex
std::optional< uint256 > txnIdFromIndex(uint32_t ledgerSeq, uint32_t txnIndex)
Definition: LedgerMaster.cpp:2426
std::runtime_error
STL class.
ripple::LedgerMaster::newPathRequest
bool newPathRequest()
Definition: LedgerMaster.cpp:1648
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::uint32_t
ripple::LedgerMaster::addHeldTransaction
void addHeldTransaction(std::shared_ptr< Transaction > const &trans)
Definition: LedgerMaster.cpp:427
ripple::LedgerMaster::setValidLedger
void setValidLedger(std::shared_ptr< Ledger const > const &l)
Definition: LedgerMaster.cpp:336
std::atomic< std::uint32_t >
ripple::LedgerMaster::mPathFindNewRequest
bool mPathFindNewRequest
Definition: LedgerMaster.h:405
ripple::LedgerHolder::get
std::shared_ptr< Ledger const > get()
Definition: LedgerHolder.h:56
ripple::LedgerMaster::getCurrentLedger
std::shared_ptr< ReadView const > getCurrentLedger()
Definition: LedgerMaster.cpp:1707
ripple::LedgerMaster::newOrderBookDB
bool newOrderBookDB()
Definition: LedgerMaster.cpp:1667
ripple::LedgerMaster::getNeededValidations
std::size_t getNeededValidations()
Determines how many validations are needed to fully validate a ledger.
Definition: LedgerMaster.cpp:1089
beast::abstract_clock< std::chrono::steady_clock >
ripple::LedgerMaster::mAdvanceThread
bool mAdvanceThread
Definition: LedgerMaster.h:398
std::condition_variable::wait_for
T wait_for(T... args)
ripple::LedgerMaster::checkAccept
void checkAccept(std::shared_ptr< Ledger const > const &ledger)
Definition: LedgerMaster.cpp:1095
beast::insight::Gauge
A metric for measuring an integral value.
Definition: Gauge.h:39
std::weak_ptr< Peer >
ripple::LedgerMaster::max_ledger_difference_
const LedgerIndex max_ledger_difference_
Definition: LedgerMaster.h:433
ripple::LedgerMaster::getFetchPackCacheSize
std::size_t getFetchPackCacheSize() const
Definition: LedgerMaster.cpp:2413
ripple::LedgerMaster::mPathLedger
std::shared_ptr< Ledger const > mPathLedger
Definition: LedgerMaster.h:376
ripple::LedgerMaster::haveValidated
bool haveValidated()
Whether we have ever fully validated a ledger.
Definition: LedgerMaster.h:288
ripple::LedgerMaster::getValidatedLedgerAge
std::chrono::seconds getValidatedLedgerAge()
Definition: LedgerMaster.cpp:274
ripple::LedgerMaster::getClosedLedger
std::shared_ptr< Ledger const > getClosedLedger()
Definition: LedgerMaster.h:98
ripple::LedgerMaster::mAdvanceWork
bool mAdvanceWork
Definition: LedgerMaster.h:401
ripple::ReadView
A view into a ledger.
Definition: ReadView.h:54
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::LedgerMaster::Stats::publishedLedgerAge
beast::insight::Gauge publishedLedgerAge
Definition: LedgerMaster.h:458
ripple::LedgerMaster::mPubLedgerClose
std::atomic< std::uint32_t > mPubLedgerClose
Definition: LedgerMaster.h:410
ripple::LedgerMaster::ledger_history_
const std::uint32_t ledger_history_
Definition: LedgerMaster.h:423
ripple::LedgerMaster::mPubLedgerSeq
std::atomic< LedgerIndex > mPubLedgerSeq
Definition: LedgerMaster.h:411
ripple::ReportingShouldProxy
Definition: LedgerMaster.h:56
ripple::LedgerMaster::~LedgerMaster
virtual ~LedgerMaster()=default
ripple::LedgerMaster::getCloseTimeBySeq
std::optional< NetClock::time_point > getCloseTimeBySeq(LedgerIndex ledgerIndex)
Definition: LedgerMaster.cpp:1766
ripple::LedgerMaster::isValidated
bool isValidated(ReadView const &ledger)
Definition: LedgerMaster.cpp:607
ripple::LedgerMaster::addFetchPack
void addFetchPack(uint256 const &hash, std::shared_ptr< Blob > data)
Definition: LedgerMaster.cpp:2193
ripple::LedgerMaster::clearLedger
void clearLedger(std::uint32_t seq)
Definition: LedgerMaster.cpp:600
ripple::ReportingShouldProxy::ReportingShouldProxy
ReportingShouldProxy()
Definition: LedgerMaster.h:59
ripple::LedgerMaster::getLedgerHashForHistory
std::optional< LedgerHash > getLedgerHashForHistory(LedgerIndex index, InboundLedger::Reason reason)
Definition: LedgerMaster.cpp:1344
ripple::LedgerMaster::m_journal
beast::Journal m_journal
Definition: LedgerMaster.h:362
std
STL namespace.
ripple::LedgerMaster::waitForValidated
void waitForValidated(std::chrono::duration< Rep, Period > const &dur)
Wait up to a specified duration for the next validated ledger.
Definition: LedgerMaster.h:312
ripple::LedgerMaster::mValidLedgerSeq
std::atomic< LedgerIndex > mValidLedgerSeq
Definition: LedgerMaster.h:413
ripple::LedgerMaster::getCurrentLedgerIndex
LedgerIndex getCurrentLedgerIndex()
Definition: LedgerMaster.cpp:207
std::condition_variable
ripple::LedgerHolder
Hold a ledger in a thread-safe way.
Definition: LedgerHolder.h:39
ripple::LedgerMaster::takeReplay
void takeReplay(std::unique_ptr< LedgerReplay > replay)
Definition: LedgerMaster.cpp:1954
ripple::LedgerMaster::getValidatedLedger
std::shared_ptr< Ledger const > getValidatedLedger()
Definition: LedgerMaster.cpp:1717
ripple::LedgerMaster::mLastValidLedger
std::pair< uint256, LedgerIndex > mLastValidLedger
Definition: LedgerMaster.h:385
ripple::Rules
Rules controlling protocol behavior.
Definition: Rules.h:33
ripple::LedgerMaster::m_stats
Stats m_stats
Definition: LedgerMaster.h:461
optional
mutex
ripple::LedgerMaster::mShardLedger
std::shared_ptr< Ledger const > mShardLedger
Definition: LedgerMaster.h:382
std::size_t
ripple::LedgerMaster::storeLedger
bool storeLedger(std::shared_ptr< Ledger const > ledger)
Definition: LedgerMaster.cpp:538
ripple::InboundLedger::Reason
Reason
Definition: InboundLedger.h:43
ripple::RangeSet
boost::icl::interval_set< T, std::less, ClosedInterval< T > > RangeSet
A set of closed intervals over the domain T.
Definition: RangeSet.h:70
ripple::LedgerMaster::setLedgerRangePresent
void setLedgerRangePresent(std::uint32_t minV, std::uint32_t maxV)
Definition: LedgerMaster.cpp:1920
ripple::LedgerMaster::consensusBuilt
void consensusBuilt(std::shared_ptr< Ledger const > const &ledger, uint256 const &consensusHash, Json::Value consensus)
Report that the consensus process built a particular ledger.
Definition: LedgerMaster.cpp:1243
ripple::LedgerMaster::tryFill
void tryFill(std::shared_ptr< Ledger const > ledger)
Definition: LedgerMaster.cpp:764
ripple::LedgerMaster::mValidLedger
LedgerHolder mValidLedger
Definition: LedgerMaster.h:370
ripple::LedgerMaster::fetch_seq_
std::uint32_t fetch_seq_
Definition: LedgerMaster.h:429
ripple::LedgerMaster::getHashBySeq
uint256 getHashBySeq(std::uint32_t index)
Get a ledger's hash by sequence number using the cache.
Definition: LedgerMaster.cpp:1796
ripple::LedgerMaster::findNewLedgersToPublish
std::vector< std::shared_ptr< Ledger const > > findNewLedgersToPublish(std::unique_lock< std::recursive_mutex > &)
Definition: LedgerMaster.cpp:1367
ripple::LedgerMaster::isCaughtUp
bool isCaughtUp(std::string &reason)
Definition: LedgerMaster.cpp:305
std::unique_ptr
STL class.
ripple::LedgerMaster::getCloseTimeByHash
std::optional< NetClock::time_point > getCloseTimeByHash(LedgerHash const &ledgerHash, LedgerIndex ledgerIndex)
Definition: LedgerMaster.cpp:1774
ripple::LedgerMaster::mPathFindThread
int mPathFindThread
Definition: LedgerMaster.h:404
ripple::LedgerMaster::mValidLedgerSign
std::atomic< std::uint32_t > mValidLedgerSign
Definition: LedgerMaster.h:412
ripple::LedgerMaster::setBuildingLedger
void setBuildingLedger(LedgerIndex index)
Definition: LedgerMaster.cpp:587
ripple::LedgerMaster::doAdvance
void doAdvance(std::unique_lock< std::recursive_mutex > &)
Definition: LedgerMaster.cpp:2092
ripple::LedgerMaster::validMutex_
std::mutex validMutex_
Definition: LedgerMaster.h:439
ripple::LedgerMaster::tryAdvance
void tryAdvance()
Definition: LedgerMaster.cpp:1512
ripple::LedgerMaster::clearPriorLedgers
void clearPriorLedgers(LedgerIndex seq)
Definition: LedgerMaster.cpp:1940
ripple::LedgerMaster::setPubLedger
void setPubLedger(std::shared_ptr< Ledger const > const &l)
Definition: LedgerMaster.cpp:419
beast::abstract_clock< NetClock >::time_point
typename NetClock ::time_point time_point
Definition: abstract_clock.h:63
ripple::LedgerMaster::popAcctTransaction
std::shared_ptr< STTx const > popAcctTransaction(std::shared_ptr< STTx const > const &tx)
Get the next transaction held for a particular account if any.
Definition: LedgerMaster.cpp:579
beast::insight::Hook
A reference to a handler for performing polled collection.
Definition: Hook.h:31
ripple::LedgerMaster::LedgerMaster
LedgerMaster(Application &app, Stopwatch &stopwatch, beast::insight::Collector::ptr const &collector, beast::Journal journal)
Definition: LedgerMaster.cpp:183
ripple::LedgerMaster::getCacheHitRate
float getCacheHitRate()
Definition: LedgerMaster.cpp:1934
Json::Value
Represents a JSON value.
Definition: json_value.h:145
beast::insight::Gauge::set
void set(value_type value) const
Set the value on the gauge.
Definition: Gauge.h:68
ripple::LedgerMaster::m_mutex
std::recursive_mutex m_mutex
Definition: LedgerMaster.h:364
ripple::LedgerMaster::Stats
Definition: LedgerMaster.h:442
ripple::LedgerMaster::collect_metrics
void collect_metrics()
Definition: LedgerMaster.h:464
ripple::LedgerMaster::standalone_
const bool standalone_
Definition: LedgerMaster.h:417