20 #ifndef RIPPLE_NODESTORE_DATABASESHARD_H_INCLUDED
21 #define RIPPLE_NODESTORE_DATABASESHARD_H_INCLUDED
23 #include <ripple/app/ledger/Ledger.h>
24 #include <ripple/basics/RangeSet.h>
25 #include <ripple/nodestore/Database.h>
26 #include <ripple/nodestore/Types.h>
28 #include <boost/optional.hpp>
56 :
Database(name, parent, scheduler, readThreads, config, journal)
78 virtual boost::optional<std::uint32_t>
113 boost::filesystem::path
const& srcDir) = 0;
175 virtual boost::filesystem::path
const&
187 return (ledgerSeq - 1) / ledgersPerShard;
194 Scheduler& scheduler,
std::unique_ptr< DatabaseShard > make_ShardStore(Application &app, Stoppable &parent, Scheduler &scheduler, int readThreads, beast::Journal j)
Holds a collection of configuration values.
Persistency layer for NodeObject.
virtual std::uint32_t earliestShardIndex() const =0
virtual std::uint32_t seqToShardIndex(std::uint32_t seq) const =0
Calculates the shard index for a given ledger sequence.
DatabaseShard(std::string const &name, Stoppable &parent, Scheduler &scheduler, int readThreads, Section const &config, beast::Journal journal)
Construct a shard store.
virtual std::uint32_t lastLedgerSeq(std::uint32_t shardIndex) const =0
Calculates the last ledger sequence for a given shard index.
virtual std::string getCompleteShards()=0
Query which complete shards are stored.
virtual boost::filesystem::path const & getRootDir() const =0
Returns the root database directory.
Provides an interface for starting and stopping.
A collection of historical shards.
A generic endpoint for log messages.
constexpr std::uint32_t seqToShardIndex(std::uint32_t ledgerSeq, std::uint32_t ledgersPerShard=DatabaseShard::ledgersPerShardDefault)
virtual std::uint32_t firstLedgerSeq(std::uint32_t shardIndex) const =0
Calculates the first ledger sequence for a given shard index.
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 std::shared_ptr< Ledger > fetchLedger(uint256 const &hash, std::uint32_t seq)=0
Fetch a ledger from the shard store.
static constexpr std::uint32_t ledgersPerShardDefault
The number of ledgers in a shard.
virtual bool importShard(std::uint32_t shardIndex, boost::filesystem::path const &srcDir)=0
Import a shard 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.
virtual boost::optional< std::uint32_t > prepareLedger(std::uint32_t validLedgerSeq)=0
Prepare to store a new ledger in the shard being acquired.
virtual void removePreShard(std::uint32_t shardIndex)=0
Remove a previously prepared shard index for import.
virtual std::uint32_t ledgersPerShard() const =0