1#ifndef XRPL_NODESTORE_DATABASE_H_INCLUDED
2#define XRPL_NODESTORE_DATABASE_H_INCLUDED
4#include <xrpl/basics/BasicConfig.h>
5#include <xrpl/basics/Log.h>
6#include <xrpl/basics/TaggedCache.ipp>
7#include <xrpl/nodestore/Backend.h>
8#include <xrpl/nodestore/NodeObject.h>
9#include <xrpl/nodestore/Scheduler.h>
10#include <xrpl/protocol/SystemParameters.h>
125 bool duplicate =
false);
233 "ripple::NodeStore::Database::storeStats : valid inputs");
A generic endpoint for log messages.
A backend used for the NodeStore.
Persistency layer for NodeObject.
void getCountsJson(Json::Value &obj)
std::atomic< std::uint32_t > fetchSz_
void storeStats(std::uint64_t count, std::uint64_t sz)
virtual void asyncFetch(uint256 const &hash, std::uint32_t ledgerSeq, std::function< void(std::shared_ptr< NodeObject > const &)> &&callback)
Fetch an object without waiting.
std::uint64_t getStoreSize() const
virtual std::string getName() const =0
Retrieve the name associated with this backend.
virtual void for_each(std::function< void(std::shared_ptr< NodeObject >)> f)=0
Visit every object in the database This is usually called during import.
virtual ~Database()
Destroy the node store.
virtual void sweep()=0
Remove expired entries from the positive and negative caches.
std::condition_variable readCondVar_
std::uint64_t getStoreCount() const
Gather statistics pertaining to read and write activities.
std::atomic< std::uint64_t > storeCount_
std::uint32_t const earliestLedgerSeq_
std::map< uint256, std::vector< std::pair< std::uint32_t, std::function< void(std::shared_ptr< NodeObject > const &)> > > > read_
std::atomic< std::uint64_t > storeSz_
virtual void importDatabase(Database &source)=0
Import objects from another database.
std::shared_ptr< NodeObject > fetchNodeObject(uint256 const &hash, std::uint32_t ledgerSeq=0, FetchType fetchType=FetchType::synchronous, bool duplicate=false)
Fetch a node object.
std::atomic< bool > readStopping_
virtual void store(NodeObjectType type, Blob &&data, uint256 const &hash, std::uint32_t ledgerSeq)=0
Store the object.
std::atomic< std::uint64_t > storeDurationUs_
std::atomic< std::uint32_t > fetchHitCount_
std::uint32_t getFetchSize() const
virtual std::int32_t getWriteLoad() const =0
Retrieve the estimated number of pending write operations.
std::atomic< std::uint64_t > fetchDurationUs_
void updateFetchMetrics(uint64_t fetches, uint64_t hits, uint64_t duration)
std::uint32_t getFetchHitCount() const
std::atomic< int > runningThreads_
std::uint32_t earliestLedgerSeq() const noexcept
virtual bool isSameDB(std::uint32_t s1, std::uint32_t s2)=0
int fdRequired() const
Returns the number of file descriptors the database expects to need.
virtual std::shared_ptr< NodeObject > fetchNodeObject(uint256 const &hash, std::uint32_t ledgerSeq, FetchReport &fetchReport, bool duplicate)=0
std::uint32_t getFetchTotalCount() const
std::atomic< std::uint64_t > fetchTotalCount_
std::atomic< int > readThreads_
void importInternal(Backend &dstBackend, Database &srcDB)
Scheduling for asynchronous backend activity.
Holds a collection of configuration values.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
NodeObjectType
The types of node objects.
Contains information about a fetch operation.