1#ifndef XRPL_NODESTORE_DATABASENODEIMP_H_INCLUDED
2#define XRPL_NODESTORE_DATABASENODEIMP_H_INCLUDED
4#include <xrpl/basics/TaggedCache.h>
5#include <xrpl/basics/chrono.h>
6#include <xrpl/nodestore/Database.h>
25 :
Database(scheduler, readThreads, config, j)
30 if (config.
exists(
"cache_size"))
32 cacheSize = get<int>(config,
"cache_size");
33 if (cacheSize.
value() < 0)
35 Throw<std::runtime_error>(
36 "Specified negative value for cache_size");
40 if (config.
exists(
"cache_age"))
42 cacheAge = get<int>(config,
"cache_age");
43 if (cacheAge.
value() < 0)
45 Throw<std::runtime_error>(
46 "Specified negative value for cache_age");
50 if (cacheSize != 0 || cacheAge != 0)
62 "ripple::NodeStore::DatabaseNodeImp::DatabaseNodeImp : non-null "
131 bool duplicate)
override;
A generic endpoint for log messages.
DatabaseNodeImp(Scheduler &scheduler, int readThreads, std::shared_ptr< Backend > backend, Section const &config, beast::Journal j)
bool isSameDB(std::uint32_t, std::uint32_t) override
std::shared_ptr< Backend > backend_
std::string getName() const override
Retrieve the name associated with this backend.
void importDatabase(Database &source) override
Import objects from another database.
std::shared_ptr< TaggedCache< uint256, NodeObject > > cache_
DatabaseNodeImp(DatabaseNodeImp const &)=delete
std::vector< std::shared_ptr< NodeObject > > fetchBatch(std::vector< uint256 > const &hashes)
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.
void asyncFetch(uint256 const &hash, std::uint32_t ledgerSeq, std::function< void(std::shared_ptr< NodeObject > const &)> &&callback) override
Fetch an object without waiting.
std::int32_t getWriteLoad() const override
Retrieve the estimated number of pending write operations.
std::shared_ptr< NodeObject > fetchNodeObject(uint256 const &hash, std::uint32_t, FetchReport &fetchReport, bool duplicate) override
DatabaseNodeImp & operator=(DatabaseNodeImp const &)=delete
void sweep() override
Remove expired entries from the positive and negative caches.
Persistency layer for NodeObject.
void importInternal(Backend &dstBackend, Database &srcDB)
Scheduling for asynchronous backend activity.
Holds a collection of configuration values.
bool exists(std::string const &name) const
Returns true if a key with the given name exists.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
NodeObjectType
The types of node objects.
Stopwatch & stopwatch()
Returns an instance of a wall clock.
Contains information about a fetch operation.