rippled
DatabaseShardImp.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2017 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_NODESTORE_DATABASESHARDIMP_H_INCLUDED
21 #define RIPPLE_NODESTORE_DATABASESHARDIMP_H_INCLUDED
22 
23 #include <ripple/nodestore/DatabaseShard.h>
24 #include <ripple/nodestore/impl/Shard.h>
25 #include <ripple/nodestore/impl/TaskQueue.h>
26 
27 #include <boost/asio/basic_waitable_timer.hpp>
28 
29 namespace ripple {
30 namespace NodeStore {
31 
33 {
34 public:
35  DatabaseShardImp() = delete;
36  DatabaseShardImp(DatabaseShardImp const&) = delete;
39  operator=(DatabaseShardImp const&) = delete;
41  operator=(DatabaseShardImp&&) = delete;
42 
44  Application& app,
45  Stoppable& parent,
46  std::string const& name,
47  Scheduler& scheduler,
48  int readThreads,
49  beast::Journal j);
50 
51  [[nodiscard]] bool
52  init() override;
53 
54  [[nodiscard]] std::optional<std::uint32_t>
55  prepareLedger(std::uint32_t validLedgerSeq) override;
56 
57  bool
58  prepareShards(std::vector<std::uint32_t> const& shardIndexes) override;
59 
60  void
61  removePreShard(std::uint32_t shardIndex) override;
62 
64  getPreShards() override;
65 
66  bool
67  importShard(std::uint32_t shardIndex, boost::filesystem::path const& srcDir)
68  override;
69 
71  fetchLedger(uint256 const& hash, std::uint32_t ledgerSeq) override;
72 
73  void
74  setStored(std::shared_ptr<Ledger const> const& ledger) override;
75 
77  getCompleteShards() override;
78 
80  ledgersPerShard() const override
81  {
82  return ledgersPerShard_;
83  }
84 
86  earliestShardIndex() const override
87  {
88  return earliestShardIndex_;
89  }
90 
92  seqToShardIndex(std::uint32_t ledgerSeq) const override
93  {
94  assert(ledgerSeq >= earliestLedgerSeq());
96  }
97 
99  firstLedgerSeq(std::uint32_t shardIndex) const override
100  {
101  assert(shardIndex >= earliestShardIndex_);
102  if (shardIndex <= earliestShardIndex_)
103  return earliestLedgerSeq();
104  return 1 + (shardIndex * ledgersPerShard_);
105  }
106 
108  lastLedgerSeq(std::uint32_t shardIndex) const override
109  {
110  assert(shardIndex >= earliestShardIndex_);
111  return (shardIndex + 1) * ledgersPerShard_;
112  }
113 
114  boost::filesystem::path const&
115  getRootDir() const override
116  {
117  return dir_;
118  }
119 
121  getName() const override
122  {
123  return backendName_;
124  }
125 
126  void
127  onStop() override;
128 
129  void
130  onChildrenStopped() override;
131 
136  void
137  import(Database& source) override;
138 
140  getWriteLoad() const override;
141 
142  bool
144  {
145  return seqToShardIndex(s1) == seqToShardIndex(s2);
146  }
147 
148  void
149  store(
150  NodeObjectType type,
151  Blob&& data,
152  uint256 const& hash,
153  std::uint32_t ledgerSeq) override;
154 
155  void
156  sync() override{};
157 
158  bool
159  storeLedger(std::shared_ptr<Ledger const> const& srcLedger) override;
160 
161  void
162  sweep() override;
163 
164  bool
166  LedgerIndex ledgerSeq,
167  std::function<bool(soci::session& session, std::uint32_t index)> const&
168  callback) override;
169 
170  bool
172  LedgerIndex ledgerSeq,
173  std::function<bool(soci::session& session, std::uint32_t index)> const&
174  callback) override;
175 
176  bool
178  std::optional<std::uint32_t> minShardIndex,
179  std::function<bool(soci::session& session, std::uint32_t index)> const&
180  callback) override;
181 
182  bool
184  std::optional<std::uint32_t> minShardIndex,
185  std::function<bool(soci::session& session, std::uint32_t index)> const&
186  callback) override;
187 
188  bool
190  std::optional<std::uint32_t> maxShardIndex,
191  std::function<bool(soci::session& session, std::uint32_t index)> const&
192  callback) override;
193 
194  bool
196  std::optional<std::uint32_t> maxShardIndex,
197  std::function<bool(soci::session& session, std::uint32_t index)> const&
198  callback) override;
199 
200 private:
201  enum class PathDesignation : uint8_t {
202  none, // No path specified
203  historical // Needs a historical path
204  };
205 
209  bool init_{false};
210 
211  // The context shared with all shard backend databases
213 
214  // Queue of background tasks to be performed
216 
217  // Shards held by this server
219 
220  // Shard indexes being imported
222 
223  // Shard index being acquired from the peer network
225 
226  // The shard store root directory
227  boost::filesystem::path dir_;
228 
229  // If new shards can be stored
230  bool canAdd_{true};
231 
232  // Complete shard indexes
234 
235  // The name associated with the backend used with the shard store
237 
238  // Maximum number of historical shards to store.
240 
241  // Contains historical shard paths
243 
244  // Storage space utilized by the shard store (in bytes)
246 
247  // Each shard stores 16384 ledgers. The earliest shard may store
248  // less if the earliest ledger sequence truncates its beginning.
249  // The value should only be altered for unit tests.
251 
252  // The earliest shard index
254 
255  // Average storage space required by a shard (in bytes)
257 
258  // The limit of final shards with open databases at any time
260 
261  // File name used to mark shards being imported from node store
262  static constexpr auto importMarker_ = "import";
263 
264  // latestShardIndex_ and secondLatestShardIndex hold the indexes
265  // of the shards most recently confirmed by the network. These
266  // values are not updated in real time and are modified only
267  // when adding shards to the database, in order to determine where
268  // pending shards will be stored on the filesystem. A value of
269  // std::nullopt indicates that the corresponding shard is not held
270  // by the database.
273 
274  // Initialize settings from the configuration file
275  // Lock must be held
276  bool
278 
281  uint256 const& hash,
282  std::uint32_t ledgerSeq,
283  FetchReport& fetchReport) override;
284 
285  void
287  {
288  Throw<std::runtime_error>("Shard store import not supported");
289  }
290 
291  // Randomly select a shard index not stored
292  // Lock must be held
295  std::uint32_t validLedgerSeq,
297 
298  // Queue a task to finalize a shard by verifying its databases
299  // Lock must be held
300  void
302  std::shared_ptr<Shard>& shard,
303  bool writeSQLite,
304  std::optional<uint256> const& expectedHash);
305 
306  // Set storage and file descriptor usage stats
307  void
308  setFileStats();
309 
310  // Update status string
311  // Lock must be held
312  void
314 
315  // Returns true if the filesystem has enough storage
316  // available to hold the specified number of shards.
317  // The value of pathDesignation determines whether
318  // the shard(s) in question are historical and thus
319  // meant to be stored at a path designated for historical
320  // shards.
321  bool
323  std::uint32_t numShards,
324  PathDesignation pathDesignation,
325  std::lock_guard<std::mutex> const&) const;
326 
327  bool
329  std::shared_ptr<Shard>& shard,
330  std::shared_ptr<Ledger const> const& ledger);
331 
332  void
334 
335  // Returns the index that represents the logical
336  // partition between historical and recent shards
338  shardBoundaryIndex() const;
339 
342 
343  // Shifts the recent and second most recent (by index)
344  // shards as new shards become available on the network.
345  // Older shards are moved to a historical shard path.
346  void
348 
349  // Checks whether the shard can be stored. If
350  // the new shard can't be stored, returns
351  // std::nullopt. Otherwise returns an enum
352  // indicating whether the new shard should be
353  // placed in a separate directory for historical
354  // shards.
357  std::uint32_t shardIndex,
359  std::lock_guard<std::mutex> const& lock);
360 
361  boost::filesystem::path
363 
364  bool
365  checkHistoricalPaths() const;
366 
376  bool
378  std::optional<std::uint32_t> minShardIndex,
379  std::function<bool(Shard& shard)> const& visit);
380 
390  bool
392  std::optional<std::uint32_t> maxShardIndex,
393  std::function<bool(Shard& shard)> const& visit);
394 };
395 
396 } // namespace NodeStore
397 } // namespace ripple
398 
399 #endif
ripple::Application
Definition: Application.h:102
ripple::NodeStore::DatabaseShardImp::earliestShardIndex_
std::uint32_t earliestShardIndex_
Definition: DatabaseShardImp.h:253
ripple::NodeStore::DatabaseShardImp::ledgersPerShard_
std::uint32_t ledgersPerShard_
Definition: DatabaseShardImp.h:250
ripple::NodeStore::DatabaseShardImp::lastLedgerSeq
std::uint32_t lastLedgerSeq(std::uint32_t shardIndex) const override
Calculates the last ledger sequence for a given shard index.
Definition: DatabaseShardImp.h:108
ripple::NodeStore::DatabaseShardImp::for_each
void for_each(std::function< void(std::shared_ptr< NodeObject >)> f) override
Visit every object in the database This is usually called during import.
Definition: DatabaseShardImp.h:286
ripple::NodeStore::DatabaseShardImp::earliestShardIndex
std::uint32_t earliestShardIndex() const override
Definition: DatabaseShardImp.h:86
ripple::NodeStore::DatabaseShardImp::mutex_
std::mutex mutex_
Definition: DatabaseShardImp.h:208
ripple::NodeStore::DatabaseShardImp::app_
Application & app_
Definition: DatabaseShardImp.h:206
ripple::NodeStore::DatabaseShardImp::storeLedger
bool storeLedger(std::shared_ptr< Ledger const > const &srcLedger) override
Store a ledger from a different database.
Definition: DatabaseShardImp.cpp:1039
ripple::NodeStore::Database
Persistency layer for NodeObject.
Definition: Database.h:50
std::string
STL class.
std::shared_ptr< Ledger >
ripple::NodeStore::DatabaseShardImp::shards_
std::map< std::uint32_t, std::shared_ptr< Shard > > shards_
Definition: DatabaseShardImp.h:218
ripple::NodeStore::DatabaseShardImp::PathDesignation
PathDesignation
Definition: DatabaseShardImp.h:201
ripple::NodeStore::DatabaseShardImp::getName
std::string getName() const override
Retrieve the name associated with this backend.
Definition: DatabaseShardImp.h:121
ripple::NodeStore::DatabaseShardImp::removePreShard
void removePreShard(std::uint32_t shardIndex) override
Remove a previously prepared shard index for import.
Definition: DatabaseShardImp.cpp:413
ripple::NodeStore::DatabaseShardImp::fileSz_
std::uint64_t fileSz_
Definition: DatabaseShardImp.h:245
std::vector
STL class.
ripple::NodeObjectType
NodeObjectType
The types of node objects.
Definition: NodeObject.h:32
ripple::NodeStore::DatabaseShardImp
Definition: DatabaseShardImp.h:32
ripple::NodeStore::DatabaseShardImp::taskQueue_
std::unique_ptr< TaskQueue > taskQueue_
Definition: DatabaseShardImp.h:215
ripple::NodeStore::DatabaseShardImp::setStored
void setStored(std::shared_ptr< Ledger const > const &ledger) override
Notifies the database that the given ledger has been fully acquired and stored.
Definition: DatabaseShardImp.cpp:624
ripple::NodeStore::DatabaseShardImp::updateStatus
void updateStatus(std::lock_guard< std::mutex > const &)
Definition: DatabaseShardImp.cpp:1450
std::lock_guard
STL class.
ripple::NodeStore::FetchReport
Contains information about a fetch operation.
Definition: ripple/nodestore/Scheduler.h:32
std::function
ripple::NodeStore::DatabaseShardImp::operator=
DatabaseShardImp & operator=(DatabaseShardImp const &)=delete
ripple::NodeStore::DatabaseShardImp::iterateTransactionSQLsBack
bool iterateTransactionSQLsBack(std::optional< std::uint32_t > maxShardIndex, std::function< bool(soci::session &session, std::uint32_t index)> const &callback) override
iterateTransactionSQLsBack Checkouts transaction databases for all shards in descending order startin...
Definition: DatabaseShardImp.cpp:2035
ripple::NodeStore::DatabaseShardImp::openFinalLimit_
const std::uint32_t openFinalLimit_
Definition: DatabaseShardImp.h:259
ripple::NodeStore::DatabaseShardImp::iterateShardsForward
bool iterateShardsForward(std::optional< std::uint32_t > minShardIndex, std::function< bool(Shard &shard)> const &visit)
iterateShardsForward Visits all shards starting from given in ascending order and calls given callbac...
Definition: DatabaseShardImp.cpp:1944
ripple::NodeStore::DatabaseShardImp::sweep
void sweep() override
Remove expired entries from the positive and negative caches.
Definition: DatabaseShardImp.cpp:1074
ripple::NodeStore::DatabaseShardImp::PathDesignation::historical
@ historical
ripple::NodeStore::DatabaseShardImp::firstLedgerSeq
std::uint32_t firstLedgerSeq(std::uint32_t shardIndex) const override
Calculates the first ledger sequence for a given shard index.
Definition: DatabaseShardImp.h:99
ripple::NodeStore::DatabaseShardImp::fetchNodeObject
std::shared_ptr< NodeObject > fetchNodeObject(uint256 const &hash, std::uint32_t ledgerSeq, FetchReport &fetchReport) override
Definition: DatabaseShardImp.cpp:1216
ripple::NodeStore::DatabaseShardImp::secondLatestShardIndex_
std::optional< std::uint32_t > secondLatestShardIndex_
Definition: DatabaseShardImp.h:272
ripple::NodeStore::DatabaseShardImp::avgShardFileSz_
std::uint64_t avgShardFileSz_
Definition: DatabaseShardImp.h:256
ripple::base_uint< 256 >
ripple::NodeStore::DatabaseShardImp::status_
std::string status_
Definition: DatabaseShardImp.h:233
ripple::NodeStore::DatabaseShardImp::getPreShards
std::string getPreShards() override
Get shard indexes being imported.
Definition: DatabaseShardImp.cpp:422
ripple::NodeStore::DatabaseShardImp::getWriteLoad
std::int32_t getWriteLoad() const override
Retrieve the estimated number of pending write operations.
Definition: DatabaseShardImp.cpp:988
ripple::NodeStore::DatabaseShardImp::findAcquireIndex
std::optional< std::uint32_t > findAcquireIndex(std::uint32_t validLedgerSeq, std::lock_guard< std::mutex > const &)
Definition: DatabaseShardImp.cpp:1235
ripple::Stoppable
Provides an interface for starting and stopping.
Definition: Stoppable.h:201
ripple::NodeStore::DatabaseShardImp::chooseHistoricalPath
boost::filesystem::path chooseHistoricalPath(std::lock_guard< std::mutex > const &) const
Definition: DatabaseShardImp.cpp:1794
ripple::NodeStore::DatabaseShardImp::sufficientStorage
bool sufficientStorage(std::uint32_t numShards, PathDesignation pathDesignation, std::lock_guard< std::mutex > const &) const
Definition: DatabaseShardImp.cpp:1465
ripple::NodeStore::DatabaseShardImp::init_
bool init_
Definition: DatabaseShardImp.h:209
ripple::NodeStore::DatabaseShardImp::getCompleteShards
std::string getCompleteShards() override
Query which complete shards are stored.
Definition: DatabaseShardImp.cpp:686
ripple::NodeStore::DatabaseShardImp::seqToShardIndex
std::uint32_t seqToShardIndex(std::uint32_t ledgerSeq) const override
Calculates the shard index for a given ledger sequence.
Definition: DatabaseShardImp.h:92
ripple::NodeStore::DatabaseShardImp::isSameDB
bool isSameDB(std::uint32_t s1, std::uint32_t s2) override
Definition: DatabaseShardImp.h:143
ripple::NodeStore::DatabaseShardImp::ledgersPerShard
std::uint32_t ledgersPerShard() const override
Definition: DatabaseShardImp.h:80
ripple::NodeStore::DatabaseShardImp::dir_
boost::filesystem::path dir_
Definition: DatabaseShardImp.h:227
ripple::NodeStore::DatabaseShardImp::callForLedgerSQL
bool callForLedgerSQL(LedgerIndex ledgerSeq, std::function< bool(soci::session &session, std::uint32_t index)> const &callback) override
callForLedgerSQL Checkouts ledger database for shard containing given ledger and calls given callback...
Definition: DatabaseShardImp.cpp:1908
ripple::NodeStore::DatabaseShardImp::removeFailedShard
void removeFailedShard(std::shared_ptr< Shard > &shard)
Definition: DatabaseShardImp.cpp:1553
ripple::NodeStore::DatabaseShard
A collection of historical shards.
Definition: DatabaseShard.h:37
ripple::NodeStore::DatabaseShardImp::importShard
bool importShard(std::uint32_t shardIndex, boost::filesystem::path const &srcDir) override
Import a shard into the shard database.
Definition: DatabaseShardImp.cpp:440
ripple::NodeStore::DatabaseShardImp::store
void store(NodeObjectType type, Blob &&data, uint256 const &hash, std::uint32_t ledgerSeq) override
Store the object.
Definition: DatabaseShardImp.cpp:1005
ripple::NodeStore::DatabaseShardImp::PathDesignation::none
@ none
ripple::NodeStore::DatabaseShardImp::checkHistoricalPaths
bool checkHistoricalPaths() const
Definition: DatabaseShardImp.cpp:1827
ripple::NodeStore::DatabaseShardImp::initConfig
bool initConfig(std::lock_guard< std::mutex > const &)
Definition: DatabaseShardImp.cpp:1128
ripple::NodeStore::DatabaseShardImp::latestShardIndex_
std::optional< std::uint32_t > latestShardIndex_
Definition: DatabaseShardImp.h:271
ripple::NodeStore::DatabaseShardImp::callForTransactionSQL
bool callForTransactionSQL(LedgerIndex ledgerSeq, std::function< bool(soci::session &session, std::uint32_t index)> const &callback) override
callForTransactionSQL Checkouts transaction database for shard containing given ledger and calls give...
Definition: DatabaseShardImp.cpp:1926
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
ripple::NodeStore::seqToShardIndex
constexpr std::uint32_t seqToShardIndex(std::uint32_t ledgerSeq, std::uint32_t ledgersPerShard=DatabaseShard::ledgersPerShardDefault)
Definition: DatabaseShard.h:280
std::uint32_t
ripple::NodeStore::Database::earliestLedgerSeq
std::uint32_t earliestLedgerSeq() const
Definition: Database.h:232
ripple::NodeStore::DatabaseShardImp::setFileStats
void setFileStats()
Definition: DatabaseShardImp.cpp:1389
ripple::NodeStore::DatabaseShardImp::acquireIndex_
std::uint32_t acquireIndex_
Definition: DatabaseShardImp.h:224
std::map
STL class.
ripple::NodeStore::Scheduler
Scheduling for asynchronous backend activity.
Definition: ripple/nodestore/Scheduler.h:60
ripple::NodeStore::DatabaseShardImp::preparedIndexes_
std::set< std::uint32_t > preparedIndexes_
Definition: DatabaseShardImp.h:221
ripple::NodeStore::DatabaseShardImp::iterateLedgerSQLsForward
bool iterateLedgerSQLsForward(std::optional< std::uint32_t > minShardIndex, std::function< bool(soci::session &session, std::uint32_t index)> const &callback) override
iterateLedgerSQLsForward Checkouts ledger databases for all shards in ascending order starting from g...
Definition: DatabaseShardImp.cpp:1971
ripple::NodeStore::DatabaseShardImp::iterateTransactionSQLsForward
bool iterateTransactionSQLsForward(std::optional< std::uint32_t > minShardIndex, std::function< bool(soci::session &session, std::uint32_t index)> const &callback) override
iterateTransactionSQLsForward Checkouts transaction databases for all shards in ascending order start...
Definition: DatabaseShardImp.cpp:1983
ripple::NodeStore::DatabaseShardImp::init
bool init() override
Initialize the database.
Definition: DatabaseShardImp.cpp:75
ripple::NodeStore::DatabaseShardImp::historicalPaths_
std::vector< boost::filesystem::path > historicalPaths_
Definition: DatabaseShardImp.h:242
ripple::NodeStore::DatabaseShardImp::getRootDir
boost::filesystem::path const & getRootDir() const override
Returns the root database directory.
Definition: DatabaseShardImp.h:115
ripple::NodeStore::DatabaseShardImp::parent_
Stoppable & parent_
Definition: DatabaseShardImp.h:207
ripple::NodeStore::DatabaseShardImp::importMarker_
static constexpr auto importMarker_
Definition: DatabaseShardImp.h:262
ripple::NodeStore::DatabaseShard::ledgersPerShardDefault
static constexpr std::uint32_t ledgersPerShardDefault
The number of ledgers in a shard.
Definition: DatabaseShard.h:276
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::NodeStore::DatabaseShardImp::maxHistoricalShards_
std::uint32_t maxHistoricalShards_
Definition: DatabaseShardImp.h:239
ripple::NodeStore::DatabaseShardImp::prepareForNewShard
std::optional< PathDesignation > prepareForNewShard(std::uint32_t shardIndex, std::uint32_t numHistoricalShards, std::lock_guard< std::mutex > const &lock)
Definition: DatabaseShardImp.cpp:1763
ripple::NodeStore::DatabaseShardImp::fetchLedger
std::shared_ptr< Ledger > fetchLedger(uint256 const &hash, std::uint32_t ledgerSeq) override
Fetch a ledger from the shard store.
Definition: DatabaseShardImp.cpp:546
ripple::NodeStore::DatabaseShardImp::iterateShardsBack
bool iterateShardsBack(std::optional< std::uint32_t > maxShardIndex, std::function< bool(Shard &shard)> const &visit)
iterateShardsBack Visits all shards starting from given in descending order and calls given callback ...
Definition: DatabaseShardImp.cpp:1995
ripple::NodeStore::DatabaseShardImp::numHistoricalShards
std::uint32_t numHistoricalShards(std::lock_guard< std::mutex > const &lock) const
Definition: DatabaseShardImp.cpp:1599
ripple::NodeStore::DatabaseShardImp::relocateOutdatedShards
void relocateOutdatedShards(std::lock_guard< std::mutex > const &lock)
Definition: DatabaseShardImp.cpp:1610
ripple::NodeStore::DatabaseShardImp::onChildrenStopped
void onChildrenStopped() override
Override called when all children have stopped.
Definition: DatabaseShardImp.cpp:708
ripple::NodeStore::DatabaseShardImp::shardBoundaryIndex
std::uint32_t shardBoundaryIndex() const
Definition: DatabaseShardImp.cpp:1583
ripple::NodeStore::DatabaseShardImp::prepareShards
bool prepareShards(std::vector< std::uint32_t > const &shardIndexes) override
Prepare one or more shard indexes to be imported into the database.
Definition: DatabaseShardImp.cpp:304
std::optional< std::uint32_t >
std::mutex
STL class.
ripple::NodeStore::DatabaseShardImp::setStoredInShard
bool setStoredInShard(std::shared_ptr< Shard > &shard, std::shared_ptr< Ledger const > const &ledger)
Definition: DatabaseShardImp.cpp:1520
ripple::NodeStore::DatabaseShardImp::canAdd_
bool canAdd_
Definition: DatabaseShardImp.h:230
ripple::NodeStore::DatabaseShardImp::finalizeShard
void finalizeShard(std::shared_ptr< Shard > &shard, bool writeSQLite, std::optional< uint256 > const &expectedHash)
Definition: DatabaseShardImp.cpp:1301
ripple::NodeStore::DatabaseShardImp::sync
void sync() override
Definition: DatabaseShardImp.h:156
ripple::NodeStore::Shard
Definition: Shard.h:52
ripple::NodeStore::DatabaseShardImp::DatabaseShardImp
DatabaseShardImp()=delete
std::unique_ptr< nudb::context >
std::set< std::uint32_t >
ripple::NodeStore::DatabaseShardImp::prepareLedger
std::optional< std::uint32_t > prepareLedger(std::uint32_t validLedgerSeq) override
Prepare to store a new ledger in the shard being acquired.
Definition: DatabaseShardImp.cpp:236
ripple::NodeStore::DatabaseShardImp::onStop
void onStop() override
Override called when the stop notification is issued.
Definition: DatabaseShardImp.cpp:695
ripple::NodeStore::DatabaseShardImp::iterateLedgerSQLsBack
bool iterateLedgerSQLsBack(std::optional< std::uint32_t > maxShardIndex, std::function< bool(soci::session &session, std::uint32_t index)> const &callback) override
iterateLedgerSQLsBack Checkouts ledger databases for all shards in descending order starting from giv...
Definition: DatabaseShardImp.cpp:2024
ripple::NodeStore::DatabaseShardImp::ctx_
std::unique_ptr< nudb::context > ctx_
Definition: DatabaseShardImp.h:212
ripple::NodeStore::DatabaseShardImp::backendName_
std::string backendName_
Definition: DatabaseShardImp.h:236