20 #ifndef RIPPLE_NODESTORE_DATABASESHARD_H_INCLUDED
21 #define RIPPLE_NODESTORE_DATABASESHARD_H_INCLUDED
23 #include <ripple/app/ledger/Ledger.h>
24 #include <ripple/core/SociDB.h>
25 #include <ripple/nodestore/Database.h>
26 #include <ripple/nodestore/ShardInfo.h>
27 #include <ripple/nodestore/Types.h>
52 :
Database(scheduler, readThreads, config, journal)
60 [[nodiscard]]
virtual bool
83 [[nodiscard]]
virtual bool
109 [[nodiscard]]
virtual bool
112 boost::filesystem::path
const& srcDir) = 0;
139 std::function<
bool(soci::session& session)>
const& callback) = 0;
149 std::function<
bool(soci::session& session)>
const& callback) = 0;
159 std::function<
bool(soci::session& session)>
const& callback) = 0;
169 std::function<
bool(soci::session& session)>
const& callback) = 0;
186 bool(soci::session& session,
std::uint32_t shardIndex)>
const&
204 bool(soci::session& session,
std::uint32_t shardIndex)>
const&
222 bool(soci::session& session,
std::uint32_t shardIndex)>
const&
240 bool(soci::session& session,
std::uint32_t shardIndex)>
const&
252 [[nodiscard]]
virtual boost::filesystem::path
const&
284 [[nodiscard]]
virtual size_t
291 Scheduler& scheduler,
Holds a collection of configuration values.
std::unique_ptr< DatabaseShard > make_ShardStore(Application &app, Scheduler &scheduler, int readThreads, beast::Journal j)
virtual bool callForLedgerSQLByLedgerSeq(LedgerIndex ledgerSeq, std::function< bool(soci::session &session)> const &callback)=0
Invoke a callback on the SQLite db holding the corresponding ledger.
virtual size_t getNumTasks() const =0
Returns the number of queued tasks.
Persistency layer for NodeObject.
virtual Json::Value getDatabaseImportStatus() const =0
Returns a JSON object detailing the status of an ongoing database import if one is running,...
virtual bool callForLedgerSQLByShardIndex(std::uint32_t shardIndex, std::function< bool(soci::session &session)> const &callback)=0
Invoke a callback on the ledger SQLite db for the corresponding shard.
virtual bool callForTransactionSQLByLedgerSeq(LedgerIndex ledgerSeq, std::function< bool(soci::session &session)> const &callback)=0
Invoke a callback on the transaction SQLite db for the corresponding ledger.
virtual boost::filesystem::path const & getRootDir() const =0
Returns the root database directory.
virtual std::optional< std::uint32_t > prepareLedger(std::uint32_t validLedgerSeq)=0
Prepare to store a new ledger in the shard being acquired.
virtual std::optional< std::uint32_t > getDatabaseImportSequence() const =0
Returns the first ledger sequence of the shard currently being imported from the NodeStore.
virtual bool iterateLedgerSQLsBack(std::optional< std::uint32_t > maxShardIndex, std::function< bool(soci::session &session, std::uint32_t shardIndex)> const &callback)=0
iterateLedgerSQLsBack Checks out ledger databases for all shards in descending order starting from gi...
virtual bool iterateLedgerSQLsForward(std::optional< std::uint32_t > minShardIndex, std::function< bool(soci::session &session, std::uint32_t shardIndex)> const &callback)=0
iterateLedgerSQLsForward Checks out ledger databases for all shards in ascending order starting from ...
virtual bool callForTransactionSQLByShardIndex(std::uint32_t shardIndex, std::function< bool(soci::session &session)> const &callback)=0
Invoke a callback on the transaction SQLite db for the corresponding shard.
A collection of historical shards.
A generic endpoint for log messages.
Scheduling for asynchronous backend activity.
virtual bool prepareShards(std::vector< std::uint32_t > const &shardIndexes)=0
Prepare one or more shard indexes to be imported into the database.
virtual bool iterateTransactionSQLsBack(std::optional< std::uint32_t > maxShardIndex, std::function< bool(soci::session &session, std::uint32_t shardIndex)> const &callback)=0
iterateTransactionSQLsBack Checks out transaction databases for all shards in descending order starti...
virtual Json::Value stopNodeToShard()=0
Terminates a NodeStore to ShardStore import and returns the result in a JSON object.
virtual std::shared_ptr< Ledger > fetchLedger(uint256 const &hash, std::uint32_t seq)=0
Fetch a ledger from the shard store.
virtual bool importShard(std::uint32_t shardIndex, boost::filesystem::path const &srcDir)=0
Import a shard from the shard archive handler into the shard database.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
virtual void setStored(std::shared_ptr< Ledger const > const &ledger)=0
Notifies the database that the given ledger has been fully acquired and stored.
virtual std::string getPreShards()=0
Get shard indexes being imported.
virtual bool init()=0
Initialize the database.
DatabaseShard(Scheduler &scheduler, int readThreads, Section const &config, beast::Journal journal)
Construct a shard store.
virtual void removePreShard(std::uint32_t shardIndex)=0
Remove a previously prepared shard index for import.
virtual Json::Value startNodeToShard()=0
Initiates a NodeStore to ShardStore import and returns the result in a JSON object.
virtual std::unique_ptr< ShardInfo > getShardInfo() const =0
Query information about shards held.
virtual bool iterateTransactionSQLsForward(std::optional< std::uint32_t > minShardIndex, std::function< bool(soci::session &session, std::uint32_t shardIndex)> const &callback)=0
iterateTransactionSQLsForward Checks out transaction databases for all shards in ascending order star...