1#include <xrpl/nodestore/detail/DatabaseRotatingImp.h>
14 , writableBackend_(
std::move(writableBackend))
15 , archiveBackend_(
std::move(archiveBackend))
31 std::string const newWritableBackendName = newBackend->getName();
49 f(newWritableBackendName, newArchiveBackendName);
69 auto const backend = [&] {
93 auto const backend = [&] {
120 status = backend->fetch(hash.
data(), &nodeObject);
134 JLOG(
j_.
fatal()) <<
"Corrupt NodeObject #" << hash;
137 JLOG(
j_.
warn()) <<
"Unknown status=" << status;
147 auto [writable, archive] = [&] {
153 nodeObject = fetch(writable);
157 nodeObject = fetch(archive);
168 writable->store(nodeObject);
182 auto [writable, archive] = [&] {
188 writable->for_each(f);
191 archive->for_each(f);
A generic endpoint for log messages.
static std::shared_ptr< NodeObject > createObject(NodeObjectType type, Blob &&data, uint256 const &hash)
Create an object from fields.
std::int32_t getWriteLoad() const override
Retrieve the estimated number of pending write operations.
std::shared_ptr< Backend > archiveBackend_
std::shared_ptr< NodeObject > fetchNodeObject(uint256 const &hash, std::uint32_t, FetchReport &fetchReport, bool duplicate) override
void store(NodeObjectType type, Blob &&data, uint256 const &hash, std::uint32_t) override
Store the object.
void importDatabase(Database &source) override
Import objects from another database.
std::string getName() const override
Retrieve the name associated with this backend.
void sweep() override
Remove expired entries from the positive and negative caches.
DatabaseRotatingImp()=delete
std::shared_ptr< Backend > writableBackend_
void rotate(std::unique_ptr< NodeStore::Backend > &&newBackend, std::function< void(std::string const &writableName, std::string const &archiveName)> const &f) override
Rotates the backends.
void for_each(std::function< void(std::shared_ptr< NodeObject >)> f) override
Visit every object in the database This is usually called during import.
Persistency layer for NodeObject.
void storeStats(std::uint64_t count, std::uint64_t sz)
int fdRequired() const
Returns the number of file descriptors the database expects to need.
void importInternal(Backend &dstBackend, Database &srcDB)
Scheduling for asynchronous backend activity.
Holds a collection of configuration values.
Status
Return codes from Backend operations.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
NodeObjectType
The types of node objects.
void Rethrow()
Rethrow the exception currently being handled.
Contains information about a fetch operation.