20#include <xrpld/nodestore/detail/DatabaseRotatingImp.h>
33 , writableBackend_(
std::move(writableBackend))
34 , archiveBackend_(
std::move(archiveBackend))
50 std::string const newWritableBackendName = newBackend->getName();
68 f(newWritableBackendName, newArchiveBackendName);
88 auto const backend = [&] {
112 auto const backend = [&] {
117 backend->store(nObj);
139 status = backend->fetch(hash.
data(), &nodeObject);
153 JLOG(
j_.
fatal()) <<
"Corrupt NodeObject #" << hash;
156 JLOG(
j_.
warn()) <<
"Unknown status=" << status;
166 auto [writable, archive] = [&] {
172 nodeObject = fetch(writable);
176 nodeObject = fetch(archive);
187 writable->store(nodeObject);
201 auto [writable, archive] = [&] {
207 writable->for_each(f);
210 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)
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.