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/LedgerCleaner.h>
27 #include <ripple/app/ledger/LedgerHistory.h>
28 #include <ripple/app/ledger/LedgerHolder.h>
29 #include <ripple/app/ledger/LedgerReplay.h>
30 #include <ripple/app/main/Application.h>
31 #include <ripple/app/misc/CanonicalTXSet.h>
32 #include <ripple/basics/RangeSet.h>
33 #include <ripple/basics/StringUtilities.h>
34 #include <ripple/basics/chrono.h>
35 #include <ripple/beast/insight/Collector.h>
36 #include <ripple/beast/utility/PropertyStream.h>
37 #include <ripple/core/Stoppable.h>
38 #include <ripple/protocol/Protocol.h>
39 #include <ripple/protocol/RippleLedgerHash.h>
40 #include <ripple/protocol/STValidation.h>
41 #include <ripple/protocol/messages.h>
42 #include <boost/optional.hpp>
43 
44 #include <mutex>
45 
46 namespace ripple {
47 
48 class Peer;
49 class Transaction;
50 
51 // This error is thrown when a codepath tries to access the open or closed
52 // ledger while the server is running in reporting mode. Any RPCs that request
53 // the open or closed ledger should be forwarded to a p2p node. Usually, the
54 // decision to forward is made based on the required condition of the handler,
55 // or which ledger is specified. However, there are some codepaths which are not
56 // covered by the aforementioned logic (though they probably should), so this
57 // error is thrown in case a codepath falls through the cracks.
59 {
60 public:
62  : std::runtime_error(
63  "Reporting mode has no open or closed ledger. Proxy this "
64  "request")
65  {
66  }
67 };
68 
69 // Tracks the current ledger and any ledgers in the process of closing
70 // Tracks ledger history
71 // Tracks held transactions
73 {
74 public:
75  // Age for last validated ledger if the process has yet to validate.
77  std::chrono::hours{24 * 14};
78 
79  explicit LedgerMaster(
80  Application& app,
82  Stoppable& parent,
83  beast::insight::Collector::ptr const& collector,
84  beast::Journal journal);
85 
86  virtual ~LedgerMaster() = default;
87 
92 
93  bool
94  isCompatible(ReadView const&, beast::Journal::Stream, char const* reason);
95 
97  peekMutex();
98 
99  // The current ledger is the ledger we believe new transactions should go in
102 
103  // The finalized ledger is the last closed/accepted ledger
106  {
107  if (app_.config().reporting())
108  {
109  Throw<ReportingShouldProxy>();
110  }
111  return mClosedLedger.get();
112  }
113 
114  // The validated ledger is the last fully validated ledger.
117 
118  // The Rules are in the last fully validated ledger if there is one.
119  Rules
121 
122  // This is the last ledger we published to clients and can lag the validated
123  // ledger
126 
131  bool
132  isCaughtUp(std::string& reason);
133 
136 
137  bool
139 
140  void
142  std::shared_ptr<Ledger const> const& ledger,
143  bool isSynchronous,
144  bool isCurrent);
145 
150  bool
152 
153  void
154  switchLCL(std::shared_ptr<Ledger const> const& lastClosed);
155 
156  void
157  failedSave(std::uint32_t seq, uint256 const& hash);
158 
161 
167  void
169 
177 
180  uint256
182 
184  boost::optional<LedgerHash>
186 
194  boost::optional<LedgerHash>
196  std::uint32_t index,
197  std::shared_ptr<ReadView const> const& referenceLedger,
198  InboundLedger::Reason reason);
199 
202 
204  getLedgerByHash(uint256 const& hash);
205 
206  void
208 
209  boost::optional<NetClock::time_point>
210  getCloseTimeBySeq(LedgerIndex ledgerIndex);
211 
212  boost::optional<NetClock::time_point>
213  getCloseTimeByHash(LedgerHash const& ledgerHash, LedgerIndex ledgerIndex);
214 
215  void
217  void
218  fixMismatch(ReadView const& ledger);
219 
220  bool
222  void
224  bool
226  bool
228 
229  void
230  tune(int size, std::chrono::seconds age);
231  void
232  sweep();
233  float
234  getCacheHitRate();
235 
236  void
238  void
239  checkAccept(uint256 const& hash, std::uint32_t seq);
240  void
242  std::shared_ptr<Ledger const> const& ledger,
243  uint256 const& consensusHash,
244  Json::Value consensus);
245 
248  void
250 
251  void
252  tryAdvance();
253  bool
254  newPathRequest(); // Returns true if path request successfully placed.
255  bool
257  bool
258  newOrderBookDB(); // Returns true if able to fulfill request.
259 
260  bool
261  fixIndex(LedgerIndex ledgerIndex, LedgerHash const& ledgerHash);
262  void
263  doLedgerCleaner(Json::Value const& parameters);
264 
267 
268  void
270 
271  void
273 
274  // ledger replay
275  void
278  releaseReplay();
279 
280  // Fetch Packs
281  void
282  gotFetchPack(bool progress, std::uint32_t seq);
283 
284  void
285  addFetchPack(uint256 const& hash, std::shared_ptr<Blob> data);
286 
287  boost::optional<Blob>
288  getFetchPack(uint256 const& hash) override;
289 
290  void
292  std::weak_ptr<Peer> const& wPeer,
294  uint256 haveLedgerHash,
295  UptimeClock::time_point uptime);
296 
298  getFetchPackCacheSize() const;
299 
301  bool
303  {
304  return !mValidLedger.empty();
305  }
306 
307  // Returns the minimum ledger sequence in SQL database, if any.
308  boost::optional<LedgerIndex>
309  minSqlSeq();
310 
311 private:
312  void
314  void
316 
317  void
319 
320  void
322 
323  boost::optional<LedgerHash>
325 
328  void
329  advanceThread();
330  void
332  std::uint32_t missing,
333  bool& progress,
334  InboundLedger::Reason reason,
336  // Try to publish ledgers, acquire missing ledgers. Always called with
337  // m_mutex locked. The passed lock is a reminder to callers.
338  void
340 
343 
344  void
345  updatePaths(Job& job);
346 
347  // Returns true if work started. Always called with m_mutex locked.
348  // The passed lock is a reminder to callers.
349  bool
351 
354 
356 
357  // The ledger that most recently closed.
359 
360  // The highest-sequence ledger we have fully accepted.
362 
363  // The last ledger we have published.
365 
366  // The last ledger we did pathfinding against.
368 
369  // The last ledger we handled fetching history
371 
372  // The last ledger we handled fetching for a shard
374 
375  // Fully validated ledger, whether or not we have the ledger resident.
377 
379 
381 
382  // A set of transactions to replay during the next close
384 
387 
389 
390  // Publish thread is running.
391  bool mAdvanceThread{false};
392 
393  // Publish thread has work to do.
394  bool mAdvanceWork{false};
396 
397  int mPathFindThread{0}; // Pathfinder jobs dispatched
398  bool mPathFindNewRequest{false};
399 
401  ATOMIC_FLAG_INIT; // GotFetchPack jobs dispatched
402 
408 
409  // The server is in standalone mode
410  bool const standalone_;
411 
412  // How many ledgers before the current ledger do we allow peers to request?
414 
415  // How much history do we want to keep
417 
419 
421 
423 
424  // Try to keep a validator from switching from test to live network
425  // without first wiping the database.
427 
428  // Time that the previous upgrade warning was issued.
430 
431 private:
432  struct Stats
433  {
434  template <class Handler>
436  Handler const& handler,
437  beast::insight::Collector::ptr const& collector)
438  : hook(collector->make_hook(handler))
440  collector->make_gauge("LedgerMaster", "Validated_Ledger_Age"))
442  collector->make_gauge("LedgerMaster", "Published_Ledger_Age"))
443  {
444  }
445 
449  };
450 
452 
453 private:
454  void
456  {
457  std::lock_guard lock(m_mutex);
460  }
461 };
462 
463 } // namespace ripple
464 
465 #endif
ripple::LedgerMaster::getValidatedRange
bool getValidatedRange(std::uint32_t &minVal, std::uint32_t &maxVal)
Definition: LedgerMaster.cpp:627
ripple::LedgerMaster::mPubLedger
std::shared_ptr< Ledger const > mPubLedger
Definition: LedgerMaster.h:364
ripple::Application
Definition: Application.h:101
ripple::LedgerMaster::mClosedLedger
LedgerHolder mClosedLedger
Definition: LedgerMaster.h:358
ripple::LedgerMaster::getPublishedLedger
std::shared_ptr< ReadView const > getPublishedLedger()
Definition: LedgerMaster.cpp:1611
ripple::LedgerMaster::fetch_packs_
TaggedCache< uint256, Blob > fetch_packs_
Definition: LedgerMaster.h:420
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:2167
ripple::LedgerMaster::clearLedgerCachePrior
void clearLedgerCachePrior(LedgerIndex seq)
Definition: LedgerMaster.cpp:1835
std::string
STL class.
std::shared_ptr< Collector >
ripple::TaggedCache
Map/cache combination.
Definition: TaggedCache.h:52
ripple::LedgerMaster::sweep
void sweep()
Definition: LedgerMaster.cpp:1808
ripple::LedgerMaster::mBuildingLedgerSeq
std::atomic< LedgerIndex > mBuildingLedgerSeq
Definition: LedgerMaster.h:407
ripple::LedgerMaster::app_
Application & app_
Definition: LedgerMaster.h:352
ripple::LedgerMaster::Stats::Stats
Stats(Handler const &handler, beast::insight::Collector::ptr const &collector)
Definition: LedgerMaster.h:435
ripple::LedgerMaster::advanceThread
void advanceThread()
Definition: LedgerMaster.cpp:1275
ripple::LedgerMaster::minSqlSeq
boost::optional< LedgerIndex > minSqlSeq()
Definition: LedgerMaster.cpp:2304
ripple::LedgerMaster::mLedgerHistory
LedgerHistory mLedgerHistory
Definition: LedgerMaster.h:378
ripple::LedgerMaster::getLedgerHashForHistory
boost::optional< LedgerHash > getLedgerHashForHistory(LedgerIndex index, InboundLedger::Reason reason)
Definition: LedgerMaster.cpp:1296
ripple::LedgerMaster::mHeldTransactions
CanonicalTXSet mHeldTransactions
Definition: LedgerMaster.h:380
std::pair
beast::PropertyStream::Source
Subclasses can be called to write to a stream and have children.
Definition: PropertyStream.h:342
ripple::LedgerMaster
Definition: LedgerMaster.h:72
ripple::LedgerMaster::getValidLedgerIndex
LedgerIndex getValidLedgerIndex()
Definition: LedgerMaster.cpp:215
std::vector
STL class.
ripple::LedgerMaster::mHistLedger
std::shared_ptr< Ledger const > mHistLedger
Definition: LedgerMaster.h:370
ripple::LedgerMaster::Stats::hook
beast::insight::Hook hook
Definition: LedgerMaster.h:446
ripple::LedgerMaster::getPublishedLedgerAge
std::chrono::seconds getPublishedLedgerAge()
Definition: LedgerMaster.cpp:252
ripple::LedgerMaster::upgradeWarningPrevTime_
TimeKeeper::time_point upgradeWarningPrevTime_
Definition: LedgerMaster.h:429
ripple::LedgerMaster::releaseReplay
std::unique_ptr< LedgerReplay > releaseReplay()
Definition: LedgerMaster.cpp:1847
std::chrono::seconds
ripple::LedgerMaster::getValidatedRules
Rules getValidatedRules()
Definition: LedgerMaster.cpp:1596
ripple::LedgerMaster::mCompleteLock
std::recursive_mutex mCompleteLock
Definition: LedgerMaster.h:385
ripple::LedgerMaster::applyHeldTransactions
void applyHeldTransactions()
Apply held transactions to the open ledger This is normally called as we close the ledger.
Definition: LedgerMaster.cpp:539
ripple::LedgerMaster::switchLCL
void switchLCL(std::shared_ptr< Ledger const > const &lastClosed)
Definition: LedgerMaster.cpp:494
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:1546
std::lock_guard
STL class.
ripple::LedgerMaster::getLedgerByHash
std::shared_ptr< Ledger const > getLedgerByHash(uint256 const &hash)
Definition: LedgerMaster.cpp:1776
ripple::LedgerMaster::walkHashBySeq
boost::optional< LedgerHash > walkHashBySeq(std::uint32_t index, InboundLedger::Reason reason)
Walk to a ledger's hash using the skip list.
Definition: LedgerMaster.cpp:1676
ripple::LedgerMaster::isNewPathRequest
bool isNewPathRequest()
Definition: LedgerMaster.cpp:1524
ripple::stopwatch
Stopwatch & stopwatch()
Returns an instance of a wall clock.
Definition: chrono.h:86
ripple::LedgerMaster::getCloseTimeByHash
boost::optional< NetClock::time_point > getCloseTimeByHash(LedgerHash const &ledgerHash, LedgerIndex ledgerIndex)
Definition: LedgerMaster.cpp:1643
ripple::LedgerMaster::getEarliestFetch
std::uint32_t getEarliestFetch()
Definition: LedgerMaster.cpp:694
ripple::LedgerHistory
Retains historical ledgers.
Definition: LedgerHistory.h:34
ripple::LedgerMaster::setFullLedger
void setFullLedger(std::shared_ptr< Ledger const > const &ledger, bool isSynchronous, bool isCurrent)
Definition: LedgerMaster.cpp:907
ripple::LedgerMaster::tune
void tune(int size, std::chrono::seconds age)
Definition: LedgerMaster.cpp:1802
std::atomic_flag
ripple::LedgerMaster::fixMismatch
void fixMismatch(ReadView const &ledger)
Definition: LedgerMaster.cpp:853
ripple::LedgerMaster::fetch_depth_
const std::uint32_t fetch_depth_
Definition: LedgerMaster.h:413
ripple::CanonicalTXSet
Holds transactions which were deferred to the next pass of consensus.
Definition: CanonicalTXSet.h:37
ripple::LedgerMaster::getCompleteLedgers
std::string getCompleteLedgers()
Definition: LedgerMaster.cpp:1618
ripple::LedgerMaster::ledger_fetch_size_
const std::uint32_t ledger_fetch_size_
Definition: LedgerMaster.h:418
ripple::LedgerMaster::Stats::validatedLedgerAge
beast::insight::Gauge validatedLedgerAge
Definition: LedgerMaster.h:447
ripple::uint256
base_uint< 256 > uint256
Definition: base_uint.h:457
ripple::LedgerMaster::peekMutex
std::recursive_mutex & peekMutex()
Definition: LedgerMaster.cpp:1564
ripple::LedgerMaster::mGotFetchPackThread
std::atomic_flag mGotFetchPackThread
Definition: LedgerMaster.h:400
ripple::base_uint
Integers of any length that is a multiple of 32-bits.
Definition: base_uint.h:73
ripple::LedgerMaster::mCompleteLedgers
RangeSet< std::uint32_t > mCompleteLedgers
Definition: LedgerMaster.h:386
ripple::LedgerMaster::getPropertySource
beast::PropertyStream::Source & getPropertySource()
Definition: LedgerMaster.cpp:1821
ripple::LedgerMaster::LedgerMaster
LedgerMaster(Application &app, Stopwatch &stopwatch, Stoppable &parent, beast::insight::Collector::ptr const &collector, beast::Journal journal)
Definition: LedgerMaster.cpp:181
ripple::Config::reporting
bool reporting() const
Definition: Config.h:267
ripple::Stoppable
Provides an interface for starting and stopping.
Definition: Stoppable.h:201
ripple::LedgerMaster::mFillInProgress
int mFillInProgress
Definition: LedgerMaster.h:395
ripple::LedgerMaster::replayData
std::unique_ptr< LedgerReplay > replayData
Definition: LedgerMaster.h:383
ripple::LedgerMaster::gotFetchPack
void gotFetchPack(bool progress, std::uint32_t seq)
Definition: LedgerMaster.cpp:2097
ripple::LedgerMaster::fetchForHistory
void fetchForHistory(std::uint32_t missing, bool &progress, InboundLedger::Reason reason, std::unique_lock< std::recursive_mutex > &)
Definition: LedgerMaster.cpp:1853
ripple::LedgerMaster::failedSave
void failedSave(std::uint32_t seq, uint256 const &hash)
Definition: LedgerMaster.cpp:967
ripple::LedgerHolder::empty
bool empty()
Definition: LedgerHolder.h:62
ripple::LedgerMaster::getFetchPack
boost::optional< Blob > getFetchPack(uint256 const &hash) override
Retrieves partial ledger data of the coresponding hash from peers.
Definition: LedgerMaster.cpp:2084
ripple::LedgerMaster::getFullValidatedRange
bool getFullValidatedRange(std::uint32_t &minVal, std::uint32_t &maxVal)
Definition: LedgerMaster.cpp:600
ripple::Application::config
virtual Config & config()=0
ripple::LedgerMaster::fixIndex
bool fixIndex(LedgerIndex ledgerIndex, LedgerHash const &ledgerHash)
Definition: LedgerMaster.cpp:520
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:145
std::unique_lock< std::recursive_mutex >
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:426
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:585
beast::Journal::Stream
Provide a light-weight way to check active() before string formatting.
Definition: Journal.h:194
ripple::LedgerMaster::isCompatible
bool isCompatible(ReadView const &, beast::Journal::Stream, char const *reason)
Definition: LedgerMaster.cpp:221
std::chrono::time_point
ripple::LedgerMaster::getLedgerBySeq
std::shared_ptr< Ledger const > getLedgerBySeq(std::uint32_t index)
Definition: LedgerMaster.cpp:1740
std::runtime_error
STL class.
ripple::LedgerMaster::newPathRequest
bool newPathRequest()
Definition: LedgerMaster.cpp:1516
ripple::Job
Definition: Job.h:82
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::uint32_t
ripple::LedgerMaster::mLedgerCleaner
std::unique_ptr< detail::LedgerCleaner > mLedgerCleaner
Definition: LedgerMaster.h:388
ripple::LedgerMaster::addHeldTransaction
void addHeldTransaction(std::shared_ptr< Transaction > const &trans)
Definition: LedgerMaster.cpp:415
ripple::LedgerMaster::setValidLedger
void setValidLedger(std::shared_ptr< Ledger const > const &l)
Definition: LedgerMaster.cpp:327
std::atomic< std::uint32_t >
ripple::LedgerMaster::mPathFindNewRequest
bool mPathFindNewRequest
Definition: LedgerMaster.h:398
ripple::LedgerHolder::get
std::shared_ptr< Ledger const > get()
Definition: LedgerHolder.h:55
ripple::LedgerMaster::getCurrentLedger
std::shared_ptr< ReadView const > getCurrentLedger()
Definition: LedgerMaster.cpp:1571
ripple::LedgerMaster::newOrderBookDB
bool newOrderBookDB()
Definition: LedgerMaster.cpp:1535
ripple::LedgerMaster::getNeededValidations
std::size_t getNeededValidations()
Determines how many validations are needed to fully validate a ledger.
Definition: LedgerMaster.cpp:1031
beast::abstract_clock< std::chrono::steady_clock >
ripple::LedgerMaster::mAdvanceThread
bool mAdvanceThread
Definition: LedgerMaster.h:391
ripple::LedgerMaster::checkAccept
void checkAccept(std::shared_ptr< Ledger const > const &ledger)
Definition: LedgerMaster.cpp:1037
beast::insight::Gauge
A metric for measuring an integral value.
Definition: Gauge.h:39
ripple::LedgerMaster::NO_VALIDATED_LEDGER_AGE
static constexpr std::chrono::seconds NO_VALIDATED_LEDGER_AGE
Definition: LedgerMaster.h:76
std::weak_ptr< Peer >
ripple::LedgerMaster::max_ledger_difference_
const LedgerIndex max_ledger_difference_
Definition: LedgerMaster.h:426
ripple::LedgerMaster::getFetchPackCacheSize
std::size_t getFetchPackCacheSize() const
Definition: LedgerMaster.cpp:2297
ripple::LedgerMaster::doLedgerCleaner
void doLedgerCleaner(Json::Value const &parameters)
Definition: LedgerMaster.cpp:1789
ripple::LedgerMaster::mPathLedger
std::shared_ptr< Ledger const > mPathLedger
Definition: LedgerMaster.h:367
ripple::LedgerMaster::haveValidated
bool haveValidated()
Whether we have ever fully validated a ledger.
Definition: LedgerMaster.h:302
ripple::LedgerMaster::getValidatedLedgerAge
std::chrono::seconds getValidatedLedgerAge()
Definition: LedgerMaster.cpp:271
ripple::LedgerMaster::getClosedLedger
std::shared_ptr< Ledger const > getClosedLedger()
Definition: LedgerMaster.h:105
ripple::LedgerMaster::mAdvanceWork
bool mAdvanceWork
Definition: LedgerMaster.h:394
ripple::ReadView
A view into a ledger.
Definition: ReadView.h:192
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:448
ripple::LedgerMaster::mPubLedgerClose
std::atomic< std::uint32_t > mPubLedgerClose
Definition: LedgerMaster.h:403
ripple::LedgerMaster::ledger_history_
const std::uint32_t ledger_history_
Definition: LedgerMaster.h:416
ripple::LedgerMaster::mPubLedgerSeq
std::atomic< LedgerIndex > mPubLedgerSeq
Definition: LedgerMaster.h:404
ripple::ReportingShouldProxy
Definition: LedgerMaster.h:58
ripple::LedgerMaster::~LedgerMaster
virtual ~LedgerMaster()=default
ripple::LedgerMaster::getBuildingLedger
LedgerIndex getBuildingLedger()
Definition: LedgerMaster.cpp:572
ripple::LedgerMaster::addFetchPack
void addFetchPack(uint256 const &hash, std::shared_ptr< Blob > data)
Definition: LedgerMaster.cpp:2078
ripple::LedgerMaster::clearLedger
void clearLedger(std::uint32_t seq)
Definition: LedgerMaster.cpp:592
ripple::ReportingShouldProxy::ReportingShouldProxy
ReportingShouldProxy()
Definition: LedgerMaster.h:61
ripple::LedgerMaster::m_journal
beast::Journal m_journal
Definition: LedgerMaster.h:353
ripple::LedgerMaster::getCloseTimeBySeq
boost::optional< NetClock::time_point > getCloseTimeBySeq(LedgerIndex ledgerIndex)
Definition: LedgerMaster.cpp:1635
std
STL namespace.
ripple::LedgerMaster::mValidLedgerSeq
std::atomic< LedgerIndex > mValidLedgerSeq
Definition: LedgerMaster.h:406
ripple::LedgerMaster::getCurrentLedgerIndex
LedgerIndex getCurrentLedgerIndex()
Definition: LedgerMaster.cpp:209
ripple::LedgerHolder
Hold a ledger in a thread-safe way.
Definition: LedgerHolder.h:38
ripple::LedgerMaster::takeReplay
void takeReplay(std::unique_ptr< LedgerReplay > replay)
Definition: LedgerMaster.cpp:1841
ripple::LedgerMaster::getValidatedLedger
std::shared_ptr< Ledger const > getValidatedLedger()
Definition: LedgerMaster.cpp:1581
ripple::LedgerMaster::mLastValidLedger
std::pair< uint256, LedgerIndex > mLastValidLedger
Definition: LedgerMaster.h:376
ripple::Rules
Rules controlling protocol behavior.
Definition: ReadView.h:131
ripple::LedgerMaster::m_stats
Stats m_stats
Definition: LedgerMaster.h:451
mutex
ripple::LedgerMaster::mShardLedger
std::shared_ptr< Ledger const > mShardLedger
Definition: LedgerMaster.h:373
ripple::LedgerMaster::updatePaths
void updatePaths(Job &job)
Definition: LedgerMaster.cpp:1438
std::size_t
ripple::LedgerMaster::storeLedger
bool storeLedger(std::shared_ptr< Ledger const > ledger)
Definition: LedgerMaster.cpp:526
ripple::InboundLedger::Reason
Reason
Definition: InboundLedger.h:45
ripple::RangeSet
boost::icl::interval_set< T, std::less, ClosedInterval< T > > RangeSet
A set of closed intervals over the domain T.
Definition: RangeSet.h:69
ripple::LedgerMaster::setLedgerRangePresent
void setLedgerRangePresent(std::uint32_t minV, std::uint32_t maxV)
Definition: LedgerMaster.cpp:1795
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:1174
ripple::LedgerMaster::mValidLedger
LedgerHolder mValidLedger
Definition: LedgerMaster.h:361
ripple::LedgerMaster::fetch_seq_
std::uint32_t fetch_seq_
Definition: LedgerMaster.h:422
ripple::LedgerMaster::getHashBySeq
uint256 getHashBySeq(std::uint32_t index)
Get a ledger's hash by sequence number using the cache.
Definition: LedgerMaster.cpp:1665
ripple::LedgerMaster::findNewLedgersToPublish
std::vector< std::shared_ptr< Ledger const > > findNewLedgersToPublish(std::unique_lock< std::recursive_mutex > &)
Definition: LedgerMaster.cpp:1319
ripple::LedgerMaster::isCaughtUp
bool isCaughtUp(std::string &reason)
Definition: LedgerMaster.cpp:303
std::unique_ptr
STL class.
ripple::LedgerMaster::mPathFindThread
int mPathFindThread
Definition: LedgerMaster.h:397
ripple::LedgerMaster::mValidLedgerSign
std::atomic< std::uint32_t > mValidLedgerSign
Definition: LedgerMaster.h:405
ripple::LedgerMaster::setBuildingLedger
void setBuildingLedger(LedgerIndex index)
Definition: LedgerMaster.cpp:579
ripple::LedgerMaster::doAdvance
void doAdvance(std::unique_lock< std::recursive_mutex > &)
Definition: LedgerMaster.cpp:1977
ripple::LedgerMaster::tryAdvance
void tryAdvance()
Definition: LedgerMaster.cpp:1423
ripple::LedgerMaster::clearPriorLedgers
void clearPriorLedgers(LedgerIndex seq)
Definition: LedgerMaster.cpp:1827
ripple::LedgerMaster::setPubLedger
void setPubLedger(std::shared_ptr< Ledger const > const &l)
Definition: LedgerMaster.cpp:407
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:564
beast::insight::Hook
A reference to a handler for performing polled collection.
Definition: Hook.h:31
ripple::LedgerMaster::tryFill
void tryFill(Job &job, std::shared_ptr< Ledger const > ledger)
Definition: LedgerMaster.cpp:708
ripple::LedgerMaster::getCacheHitRate
float getCacheHitRate()
Definition: LedgerMaster.cpp:1815
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:355
ripple::LedgerMaster::Stats
Definition: LedgerMaster.h:432
ripple::LedgerMaster::collect_metrics
void collect_metrics()
Definition: LedgerMaster.h:455
ripple::LedgerMaster::standalone_
const bool standalone_
Definition: LedgerMaster.h:410