20 #ifndef RIPPLE_NODESTORE_DATABASE_H_INCLUDED
21 #define RIPPLE_NODESTORE_DATABASE_H_INCLUDED
23 #include <ripple/basics/KeyCache.h>
24 #include <ripple/basics/TaggedCache.h>
25 #include <ripple/core/Stoppable.h>
26 #include <ripple/nodestore/Backend.h>
27 #include <ripple/nodestore/NodeObject.h>
28 #include <ripple/nodestore/Scheduler.h>
29 #include <ripple/protocol/SystemParameters.h>
std::uint32_t getFetchSize() const
Holds a collection of configuration values.
virtual std::int32_t getWriteLoad() const =0
Retrieve the estimated number of pending write operations.
std::uint64_t getStoreCount() const
Gather statistics pertaining to read and write activities.
std::atomic< std::uint64_t > fetchDurationUs_
Persistency layer for NodeObject.
NodeObjectType
The types of node objects.
std::map< uint256, std::vector< std::pair< std::uint32_t, std::function< void(std::shared_ptr< NodeObject > const &)> > > > read_
virtual Backend & getBackend()=0
std::atomic< std::uint64_t > fetchTotalCount_
void asyncFetch(uint256 const &hash, std::uint32_t ledgerSeq, std::function< void(std::shared_ptr< NodeObject > const &)> &&callback)
Fetch an object without waiting.
std::atomic< std::uint32_t > fetchSz_
Contains information about a fetch operation.
virtual void store(NodeObjectType type, Blob &&data, uint256 const &hash, std::uint32_t ledgerSeq)=0
Store the object.
std::atomic< std::uint32_t > fetchHitCount_
std::atomic< std::uint64_t > storeCount_
void updateFetchMetrics(uint64_t fetches, uint64_t hits, uint64_t duration)
void onChildrenStopped() override
Override called when all children have stopped.
virtual std::string getName() const =0
Retrieve the name associated with this backend.
std::uint64_t getStoreSize() const
std::atomic< std::uint64_t > storeSz_
Provides an interface for starting and stopping.
void importInternal(Backend &dstBackend, Database &srcDB)
std::condition_variable readCondVar_
A generic endpoint for log messages.
std::uint32_t earliestLedgerSeq() const
Scheduling for asynchronous backend activity.
std::shared_ptr< NodeObject > fetchNodeObject(uint256 const &hash, std::uint32_t ledgerSeq=0, FetchType fetchType=FetchType::synchronous)
Fetch a node object.
virtual ~Database()
Destroy the node store.
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 void sweep()=0
Remove expired entries from the positive and negative caches.
void storeStats(std::uint64_t count, std::uint64_t sz)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
void onStop() override
Override called when the stop notification is issued.
virtual bool storeLedger(std::shared_ptr< Ledger const > const &srcLedger)=0
Store a ledger from a different database.
std::vector< std::thread > readThreads_
std::atomic< std::uint64_t > storeDurationUs_
void getCountsJson(Json::Value &obj)
const std::uint32_t earliestLedgerSeq_
std::uint32_t getFetchHitCount() const
std::uint32_t getFetchTotalCount() const
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.
A backend used for the NodeStore.