20#include <xrpld/nodestore/detail/DatabaseRotatingImp.h>
21#include <xrpl/protocol/HashPrefix.h>
34 , writableBackend_(
std::move(writableBackend))
35 , archiveBackend_(
std::move(archiveBackend))
73 auto const backend = [&] {
97 auto const backend = [&] {
102 backend->store(nObj);
124 status = backend->fetch(hash.
data(), &nodeObject);
138 JLOG(
j_.
fatal()) <<
"Corrupt NodeObject #" << hash;
141 JLOG(
j_.
warn()) <<
"Unknown status=" << status;
151 auto [writable, archive] = [&] {
157 nodeObject = fetch(writable);
161 nodeObject = fetch(archive);
172 writable->store(nodeObject);
186 auto [writable, archive] = [&] {
192 writable->for_each(f);
195 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::recursive_mutex mutex_
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 rotateWithLock(std::function< std::unique_ptr< NodeStore::Backend >(std::string const &writableBackendName)> const &f) override
Rotates the backends.
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 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.