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  Scheduler& scheduler,
46  int readThreads,
47  beast::Journal j);
48 
50  {
51  stop();
52  }
53 
54  [[nodiscard]] bool
55  init() override;
56 
58  prepareLedger(std::uint32_t validLedgerSeq) override;
59 
60  bool
61  prepareShards(std::vector<std::uint32_t> const& shardIndexes) override;
62 
63  void
64  removePreShard(std::uint32_t shardIndex) override;
65 
67  getPreShards() override;
68 
69  bool
70  importShard(std::uint32_t shardIndex, boost::filesystem::path const& srcDir)
71  override;
72 
74  fetchLedger(uint256 const& hash, std::uint32_t ledgerSeq) override;
75 
76  void
77  setStored(std::shared_ptr<Ledger const> const& ledger) override;
78 
80  getShardInfo() const override;
81 
82  size_t
83  getNumTasks() const override;
84 
85  boost::filesystem::path const&
86  getRootDir() const override
87  {
88  return dir_;
89  }
90 
92  getName() const override
93  {
94  return backendName_;
95  }
96 
97  void
98  stop() override;
99 
104  void
105  importDatabase(Database& source) override;
106 
107  void
109 
111  getWriteLoad() const override;
112 
113  bool
115  {
116  return seqToShardIndex(s1) == seqToShardIndex(s2);
117  }
118 
119  void
120  store(
121  NodeObjectType type,
122  Blob&& data,
123  uint256 const& hash,
124  std::uint32_t ledgerSeq) override;
125 
126  void
127  sync() override{};
128 
129  bool
130  storeLedger(std::shared_ptr<Ledger const> const& srcLedger) override;
131 
132  void
133  sweep() override;
134 
136  getDatabaseImportStatus() const override;
137 
139  getDatabaseImportSequence() const override;
140 
141  bool
143  LedgerIndex ledgerSeq,
144  std::function<bool(soci::session& session)> const& callback) override;
145 
146  bool
148  std::uint32_t const shardIndex,
149  std::function<bool(soci::session& session)> const& callback) override;
150 
151  bool
153  LedgerIndex ledgerSeq,
154  std::function<bool(soci::session& session)> const& callback) override;
155 
156  bool
158  std::uint32_t const shardIndex,
159  std::function<bool(soci::session& session)> const& callback) override;
160 
161  bool
163  std::optional<std::uint32_t> minShardIndex,
165  bool(soci::session& session, std::uint32_t shardIndex)> const&
166  callback) override;
167 
168  bool
170  std::optional<std::uint32_t> minShardIndex,
172  bool(soci::session& session, std::uint32_t shardIndex)> const&
173  callback) override;
174 
175  bool
177  std::optional<std::uint32_t> maxShardIndex,
179  bool(soci::session& session, std::uint32_t shardIndex)> const&
180  callback) override;
181 
182  bool
184  std::optional<std::uint32_t> maxShardIndex,
186  bool(soci::session& session, std::uint32_t shardIndex)> const&
187  callback) override;
188 
189 private:
190  enum class PathDesignation : uint8_t {
191  none, // No path specified
192  historical // Needs a historical path
193  };
194 
196  {
204  {
205  }
206 
207  // Index of the first shard to be imported
209 
210  // Index of the last shard to be imported
212 
213  // Index of the shard currently being imported
215 
216  // First ledger sequence of the current shard
218 
219  // Last ledger sequence of the current shard
221 
222  // The shard currently being imported
224  };
225 
228  bool init_{false};
229 
230  // The context shared with all shard backend databases
232 
233  // Queue of background tasks to be performed
235 
236  // Shards held by this server
238 
239  // Shard indexes being imported from the shard archive handler
241 
242  // Shard index being acquired from the peer network
244 
245  // The shard store root directory
246  boost::filesystem::path dir_;
247 
248  // If new shards can be stored
249  bool canAdd_{true};
250 
251  // The name associated with the backend used with the shard store
253 
254  // Maximum number of historical shards to store.
256 
257  // Contains historical shard paths
259 
260  // Storage space utilized by the shard store (in bytes)
262 
263  // Average storage space required by a shard (in bytes)
265 
266  // The limit of final shards with open databases at any time
268 
269  // File name used to mark shards being imported from node store
270  static constexpr auto databaseImportMarker_ = "database_import";
271 
272  // latestShardIndex_ and secondLatestShardIndex hold the indexes
273  // of the shards most recently confirmed by the network. These
274  // values are not updated in real time and are modified only
275  // when adding shards to the database, in order to determine where
276  // pending shards will be stored on the filesystem. A value of
277  // std::nullopt indicates that the corresponding shard is not held
278  // by the database.
281 
282  // Struct used for node store import progress
284 
285  // Thread for running node store import
287 
288  // Initialize settings from the configuration file
289  // Lock must be held
290  bool
292 
295  uint256 const& hash,
296  std::uint32_t ledgerSeq,
297  FetchReport& fetchReport) override;
298 
299  void
301  {
302  Throw<std::runtime_error>("Import from shard store not supported");
303  }
304 
305  // Randomly select a shard index not stored
306  // Lock must be held
309  std::uint32_t validLedgerSeq,
311 
312  // Queue a task to finalize a shard by verifying its databases
313  // Lock must be held
314  void
316  std::shared_ptr<Shard>& shard,
317  bool writeSQLite,
318  std::optional<uint256> const& expectedHash);
319 
320  // Update storage and file descriptor usage stats
321  void
322  updateFileStats();
323 
324  // Returns true if the file system has enough storage
325  // available to hold the specified number of shards.
326  // The value of pathDesignation determines whether
327  // the shard(s) in question are historical and thus
328  // meant to be stored at a path designated for historical
329  // shards.
330  bool
332  std::uint32_t numShards,
333  PathDesignation pathDesignation,
334  std::lock_guard<std::mutex> const&) const;
335 
336  bool
338  std::shared_ptr<Shard>& shard,
339  std::shared_ptr<Ledger const> const& ledger);
340 
341  void
343 
344  // Returns the index that represents the logical
345  // partition between historical and recent shards
347  shardBoundaryIndex() const;
348 
351 
352  // Shifts the recent and second most recent (by index)
353  // shards as new shards become available on the network.
354  // Older shards are moved to a historical shard path.
355  void
357 
358  // Checks whether the shard can be stored. If
359  // the new shard can't be stored, returns
360  // std::nullopt. Otherwise returns an enum
361  // indicating whether the new shard should be
362  // placed in a separate directory for historical
363  // shards.
366  std::uint32_t shardIndex,
368  std::lock_guard<std::mutex> const& lock);
369 
370  boost::filesystem::path
372 
382  bool
384  std::optional<std::uint32_t> minShardIndex,
385  std::function<bool(Shard& shard)> const& visit);
386 
396  bool
398  std::optional<std::uint32_t> maxShardIndex,
399  std::function<bool(Shard& shard)> const& visit);
400 
401  bool
403 
406 
407  // Update peers with the status of every complete and incomplete shard
408  void
409  updatePeers(std::lock_guard<std::mutex> const& lock) const;
410 };
411 
412 } // namespace NodeStore
413 } // namespace ripple
414 
415 #endif
ripple::NodeStore::DatabaseShardImp::iterateLedgerSQLsForward
bool iterateLedgerSQLsForward(std::optional< std::uint32_t > minShardIndex, std::function< bool(soci::session &session, std::uint32_t shardIndex)> const &callback) override
iterateLedgerSQLsForward Checks out ledger databases for all shards in ascending order starting from ...
Definition: DatabaseShardImp.cpp:2024
ripple::Application
Definition: Application.h:103
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:300
ripple::NodeStore::DatabaseShardImp::mutex_
std::mutex mutex_
Definition: DatabaseShardImp.h:227
ripple::NodeStore::DatabaseShardImp::app_
Application & app_
Definition: DatabaseShardImp.h:226
ripple::NodeStore::DatabaseShardImp::storeLedger
bool storeLedger(std::shared_ptr< Ledger const > const &srcLedger) override
Store a ledger from a different database.
Definition: DatabaseShardImp.cpp:1113
ripple::NodeStore::Database
Persistency layer for NodeObject.
Definition: Database.h:52
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:237
ripple::NodeStore::DatabaseShardImp::PathDesignation
PathDesignation
Definition: DatabaseShardImp.h:190
ripple::NodeStore::DatabaseShardImp::callForLedgerSQLByLedgerSeq
bool callForLedgerSQLByLedgerSeq(LedgerIndex ledgerSeq, std::function< bool(soci::session &session)> const &callback) override
Invoke a callback on the SQLite db holding the corresponding ledger.
Definition: DatabaseShardImp.cpp:1951
ripple::NodeStore::DatabaseShardImp::DatabaseImportStatus::lastSeq
std::uint32_t lastSeq
Definition: DatabaseShardImp.h:220
ripple::NodeStore::DatabaseShardImp::getName
std::string getName() const override
Retrieve the name associated with this backend.
Definition: DatabaseShardImp.h:92
ripple::NodeStore::DatabaseShardImp::removePreShard
void removePreShard(std::uint32_t shardIndex) override
Remove a previously prepared shard index for import.
Definition: DatabaseShardImp.cpp:416
ripple::NodeStore::DatabaseShardImp::~DatabaseShardImp
~DatabaseShardImp()
Definition: DatabaseShardImp.h:49
ripple::NodeStore::DatabaseShardImp::fileSz_
std::uint64_t fileSz_
Definition: DatabaseShardImp.h:261
std::vector
STL class.
ripple::NodeStore::DatabaseShardImp::stop
void stop() override
Definition: DatabaseShardImp.cpp:699
ripple::NodeObjectType
NodeObjectType
The types of node objects.
Definition: NodeObject.h:32
ripple::NodeStore::DatabaseShardImp
Definition: DatabaseShardImp.h:32
ripple::NodeStore::DatabaseShardImp::taskQueue_
TaskQueue taskQueue_
Definition: DatabaseShardImp.h:234
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:630
ripple::NodeStore::DatabaseShardImp::DatabaseImportStatus::DatabaseImportStatus
DatabaseImportStatus(std::uint32_t const earliestIndex, std::uint32_t const latestIndex, std::uint32_t const currentIndex)
Definition: DatabaseShardImp.h:197
std::lock_guard
STL class.
ripple::NodeStore::FetchReport
Contains information about a fetch operation.
Definition: ripple/nodestore/Scheduler.h:32
ripple::NodeStore::DatabaseShardImp::getDatabaseImportSequence
std::optional< std::uint32_t > getDatabaseImportSequence() const override
Returns the first ledger sequence of the shard currently being imported from the NodeStore.
Definition: DatabaseShardImp.cpp:1226
std::function
ripple::NodeStore::DatabaseShardImp::operator=
DatabaseShardImp & operator=(DatabaseShardImp const &)=delete
ripple::NodeStore::DatabaseShardImp::importDatabase
void importDatabase(Database &source) override
Import the application local node store.
Definition: DatabaseShardImp.cpp:742
ripple::NodeStore::DatabaseShardImp::databaseImporter_
std::thread databaseImporter_
Definition: DatabaseShardImp.h:286
ripple::NodeStore::DatabaseShardImp::openFinalLimit_
const std::uint32_t openFinalLimit_
Definition: DatabaseShardImp.h:267
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:1996
ripple::NodeStore::DatabaseShardImp::sweep
void sweep() override
Remove expired entries from the positive and negative caches.
Definition: DatabaseShardImp.cpp:1148
ripple::NodeStore::DatabaseShardImp::PathDesignation::historical
@ historical
ripple::NodeStore::DatabaseShardImp::getDatabaseImportStatus
Json::Value getDatabaseImportStatus() const override
Definition: DatabaseShardImp.cpp:1200
ripple::NodeStore::DatabaseShardImp::fetchNodeObject
std::shared_ptr< NodeObject > fetchNodeObject(uint256 const &hash, std::uint32_t ledgerSeq, FetchReport &fetchReport) override
Definition: DatabaseShardImp.cpp:1311
ripple::NodeStore::DatabaseShardImp::secondLatestShardIndex_
std::optional< std::uint32_t > secondLatestShardIndex_
Definition: DatabaseShardImp.h:280
ripple::NodeStore::DatabaseShardImp::avgShardFileSz_
std::uint64_t avgShardFileSz_
Definition: DatabaseShardImp.h:264
ripple::NodeStore::DatabaseShardImp::callForTransactionSQLByLedgerSeq
bool callForTransactionSQLByLedgerSeq(LedgerIndex ledgerSeq, std::function< bool(soci::session &session)> const &callback) override
Invoke a callback on the transaction SQLite db for the corresponding ledger.
Definition: DatabaseShardImp.cpp:1973
ripple::base_uint< 256 >
ripple::NodeStore::DatabaseShardImp::updatePeers
void updatePeers(std::lock_guard< std::mutex > const &lock) const
Definition: DatabaseShardImp.cpp:2122
ripple::NodeStore::DatabaseShardImp::getPreShards
std::string getPreShards() override
Get shard indexes being imported.
Definition: DatabaseShardImp.cpp:426
ripple::NodeStore::DatabaseShardImp::databaseImportStatus_
std::unique_ptr< DatabaseImportStatus > databaseImportStatus_
Definition: DatabaseShardImp.h:283
ripple::NodeStore::DatabaseShardImp::getWriteLoad
std::int32_t getWriteLoad() const override
Retrieve the estimated number of pending write operations.
Definition: DatabaseShardImp.cpp:1062
ripple::NodeStore::DatabaseShardImp::findAcquireIndex
std::optional< std::uint32_t > findAcquireIndex(std::uint32_t validLedgerSeq, std::lock_guard< std::mutex > const &)
Definition: DatabaseShardImp.cpp:1330
ripple::NodeStore::TaskQueue
Definition: TaskQueue.h:31
ripple::NodeStore::DatabaseShardImp::iterateTransactionSQLsBack
bool iterateTransactionSQLsBack(std::optional< std::uint32_t > maxShardIndex, std::function< bool(soci::session &session, std::uint32_t shardIndex)> const &callback) override
iterateTransactionSQLsBack Checks out transaction databases for all shards in descending order starti...
Definition: DatabaseShardImp.cpp:2088
ripple::NodeStore::DatabaseShardImp::DatabaseImportStatus::currentIndex
std::uint32_t currentIndex
Definition: DatabaseShardImp.h:214
ripple::NodeStore::DatabaseShardImp::chooseHistoricalPath
boost::filesystem::path chooseHistoricalPath(std::lock_guard< std::mutex > const &) const
Definition: DatabaseShardImp.cpp:1837
ripple::NodeStore::DatabaseShardImp::sufficientStorage
bool sufficientStorage(std::uint32_t numShards, PathDesignation pathDesignation, std::lock_guard< std::mutex > const &) const
Definition: DatabaseShardImp.cpp:1530
ripple::NodeStore::DatabaseShardImp::init_
bool init_
Definition: DatabaseShardImp.h:228
std::thread
STL class.
ripple::NodeStore::DatabaseShardImp::isSameDB
bool isSameDB(std::uint32_t s1, std::uint32_t s2) override
Definition: DatabaseShardImp.h:114
ripple::NodeStore::DatabaseShardImp::callForLedgerSQLByShardIndex
bool callForLedgerSQLByShardIndex(std::uint32_t const shardIndex, std::function< bool(soci::session &session)> const &callback) override
Invoke a callback on the ledger SQLite db for the corresponding shard.
Definition: DatabaseShardImp.cpp:1959
ripple::NodeStore::DatabaseShardImp::doImportDatabase
void doImportDatabase()
Definition: DatabaseShardImp.cpp:763
ripple::NodeStore::DatabaseShardImp::dir_
boost::filesystem::path dir_
Definition: DatabaseShardImp.h:246
ripple::NodeStore::DatabaseShardImp::removeFailedShard
void removeFailedShard(std::shared_ptr< Shard > &shard)
Definition: DatabaseShardImp.cpp:1618
ripple::NodeStore::DatabaseShard
A collection of historical shards.
Definition: DatabaseShard.h:37
ripple::NodeStore::DatabaseShardImp::getNumTasks
size_t getNumTasks() const override
Returns the number of queued tasks.
Definition: DatabaseShardImp.cpp:2115
ripple::NodeStore::DatabaseShardImp::importShard
bool importShard(std::uint32_t shardIndex, boost::filesystem::path const &srcDir) override
Import a shard from the shard archive handler into the shard database.
Definition: DatabaseShardImp.cpp:444
ripple::NodeStore::DatabaseShardImp::store
void store(NodeObjectType type, Blob &&data, uint256 const &hash, std::uint32_t ledgerSeq) override
Definition: DatabaseShardImp.cpp:1079
ripple::NodeStore::DatabaseShardImp::PathDesignation::none
@ none
ripple::NodeStore::DatabaseShardImp::initConfig
bool initConfig(std::lock_guard< std::mutex > const &)
Definition: DatabaseShardImp.cpp:1237
ripple::NodeStore::DatabaseShardImp::latestShardIndex_
std::optional< std::uint32_t > latestShardIndex_
Definition: DatabaseShardImp.h:279
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::uint32_t
ripple::NodeStore::DatabaseShardImp::acquireIndex_
std::uint32_t acquireIndex_
Definition: DatabaseShardImp.h:243
std::map
STL class.
ripple::NodeStore::Scheduler
Scheduling for asynchronous backend activity.
Definition: ripple/nodestore/Scheduler.h:60
ripple::NodeStore::DatabaseShardImp::DatabaseImportStatus::latestIndex
std::uint32_t latestIndex
Definition: DatabaseShardImp.h:211
ripple::NodeStore::DatabaseShardImp::preparedIndexes_
std::set< std::uint32_t > preparedIndexes_
Definition: DatabaseShardImp.h:240
ripple::NodeStore::DatabaseShardImp::init
bool init() override
Initialize the database.
Definition: DatabaseShardImp.cpp:70
std::weak_ptr
STL class.
ripple::NodeStore::DatabaseShardImp::historicalPaths_
std::vector< boost::filesystem::path > historicalPaths_
Definition: DatabaseShardImp.h:258
ripple::NodeStore::DatabaseShardImp::getRootDir
boost::filesystem::path const & getRootDir() const override
Returns the root database directory.
Definition: DatabaseShardImp.h:86
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::NodeStore::DatabaseShardImp::checkHistoricalPaths
bool checkHistoricalPaths(std::lock_guard< std::mutex > const &) const
Definition: DatabaseShardImp.cpp:1870
ripple::NodeStore::DatabaseShardImp::maxHistoricalShards_
std::uint32_t maxHistoricalShards_
Definition: DatabaseShardImp.h:255
ripple::NodeStore::DatabaseShardImp::DatabaseImportStatus::currentShard
std::weak_ptr< Shard > currentShard
Definition: DatabaseShardImp.h:223
ripple::NodeStore::DatabaseShardImp::callForTransactionSQLByShardIndex
bool callForTransactionSQLByShardIndex(std::uint32_t const shardIndex, std::function< bool(soci::session &session)> const &callback) override
Invoke a callback on the transaction SQLite db for the corresponding shard.
Definition: DatabaseShardImp.cpp:1982
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:552
ripple::NodeStore::Database::seqToShardIndex
std::uint32_t seqToShardIndex(std::uint32_t ledgerSeq) const noexcept
Calculates the shard index for a given ledger sequence.
Definition: Database.h:283
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:2048
ripple::NodeStore::DatabaseShardImp::numHistoricalShards
std::uint32_t numHistoricalShards(std::lock_guard< std::mutex > const &lock) const
Definition: DatabaseShardImp.cpp:1658
ripple::NodeStore::DatabaseShardImp::relocateOutdatedShards
void relocateOutdatedShards(std::lock_guard< std::mutex > const &lock)
Definition: DatabaseShardImp.cpp:1669
ripple::NodeStore::DatabaseShardImp::iterateLedgerSQLsBack
bool iterateLedgerSQLsBack(std::optional< std::uint32_t > maxShardIndex, std::function< bool(soci::session &session, std::uint32_t shardIndex)> const &callback) override
iterateLedgerSQLsBack Checks out ledger databases for all shards in descending order starting from gi...
Definition: DatabaseShardImp.cpp:2077
ripple::NodeStore::DatabaseShardImp::updateFileStats
void updateFileStats()
Definition: DatabaseShardImp.cpp:1469
ripple::NodeStore::DatabaseShardImp::shardBoundaryIndex
std::uint32_t shardBoundaryIndex() const
Definition: DatabaseShardImp.cpp:1642
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:299
std::optional< std::uint32_t >
ripple::NodeStore::DatabaseShardImp::DatabaseImportStatus::firstSeq
std::uint32_t firstSeq
Definition: DatabaseShardImp.h:217
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:1585
ripple::NodeStore::DatabaseShardImp::canAdd_
bool canAdd_
Definition: DatabaseShardImp.h:249
ripple::NodeStore::DatabaseShardImp::finalizeShard
void finalizeShard(std::shared_ptr< Shard > &shard, bool writeSQLite, std::optional< uint256 > const &expectedHash)
Definition: DatabaseShardImp.cpp:1395
ripple::NodeStore::DatabaseShardImp::sync
void sync() override
Definition: DatabaseShardImp.h:127
ripple::NodeStore::Shard
Definition: Shard.h:53
ripple::NodeStore::DatabaseShardImp::DatabaseShardImp
DatabaseShardImp()=delete
ripple::NodeStore::DatabaseShardImp::DatabaseImportStatus
Definition: DatabaseShardImp.h:195
std::unique_ptr
STL class.
ripple::NodeStore::DatabaseShardImp::databaseImportMarker_
static constexpr auto databaseImportMarker_
Definition: DatabaseShardImp.h:270
ripple::NodeStore::DatabaseShardImp::DatabaseImportStatus::earliestIndex
std::uint32_t earliestIndex
Definition: DatabaseShardImp.h:208
std::set< std::uint32_t >
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:1806
ripple::NodeStore::DatabaseShardImp::iterateTransactionSQLsForward
bool iterateTransactionSQLsForward(std::optional< std::uint32_t > minShardIndex, std::function< bool(soci::session &session, std::uint32_t shardIndex)> const &callback) override
iterateTransactionSQLsForward Checks out transaction databases for all shards in ascending order star...
Definition: DatabaseShardImp.cpp:2036
Json::Value
Represents a JSON value.
Definition: json_value.h:145
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:229
ripple::NodeStore::DatabaseShardImp::ctx_
std::unique_ptr< nudb::context > ctx_
Definition: DatabaseShardImp.h:231
ripple::NodeStore::DatabaseShardImp::backendName_
std::string backendName_
Definition: DatabaseShardImp.h:252
ripple::NodeStore::DatabaseShardImp::getShardInfo
std::unique_ptr< ShardInfo > getShardInfo() const override
Query information about shards held.
Definition: DatabaseShardImp.cpp:692