20 #include <ripple/app/ledger/Ledger.h>
21 #include <ripple/nodestore/impl/DatabaseRotatingImp.h>
22 #include <ripple/protocol/HashPrefix.h>
35 , writableBackend_(
std::move(writableBackend))
36 , archiveBackend_(
std::move(archiveBackend))
74 auto const backend = [&] {
85 auto const backend = [&] {
109 auto const backend = [&] {
114 backend->store(nObj);
136 status = backend->fetch(hash.
data(), &nodeObject);
150 JLOG(
j_.
fatal()) <<
"Corrupt NodeObject #" << hash;
153 JLOG(
j_.
warn()) <<
"Unknown status=" << status;
163 auto [writable, archive] = [&] {
169 nodeObject = fetch(writable);
173 nodeObject = fetch(archive);
184 writable->store(nodeObject);
198 auto [writable, archive] = [&] {
204 writable->for_each(f);
207 archive->for_each(f);
Holds a collection of configuration values.
void rotateWithLock(std::function< std::unique_ptr< NodeStore::Backend >(std::string const &writableBackendName)> const &f) override
Rotates the backends.
void importDatabase(Database &source) override
Import objects from another database.
std::shared_ptr< Backend > archiveBackend_
Persistency layer for NodeObject.
void sweep() override
Remove expired entries from the positive and negative caches.
std::shared_ptr< NodeObject > fetchNodeObject(uint256 const &hash, std::uint32_t, FetchReport &fetchReport, bool duplicate) override
NodeObjectType
The types of node objects.
static std::shared_ptr< NodeObject > createObject(NodeObjectType type, Blob &&data, uint256 const &hash)
Create an object from fields.
DatabaseRotatingImp()=delete
Contains information about a fetch operation.
std::string getName() const override
Retrieve the name associated with this backend.
std::int32_t getWriteLoad() const override
Retrieve the estimated number of pending write operations.
void importInternal(Backend &dstBackend, Database &srcDB)
void Rethrow()
Rethrow the exception currently being handled.
bool storeLedger(std::shared_ptr< Ledger const > const &srcLedger) override
Store a ledger from a different database.
A generic endpoint for log messages.
Scheduling for asynchronous backend activity.
void storeStats(std::uint64_t count, std::uint64_t sz)
Status
Return codes from Backend operations.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
virtual bool storeLedger(std::shared_ptr< Ledger const > const &srcLedger)=0
Store a ledger from a different database.
void store(NodeObjectType type, Blob &&data, uint256 const &hash, std::uint32_t) override
Store the object.
void for_each(std::function< void(std::shared_ptr< NodeObject >)> f) override
Visit every object in the database This is usually called during import.
std::shared_ptr< Backend > writableBackend_