#include <DatabaseRotating.h>
|
| | DatabaseRotating (Scheduler &scheduler, int readThreads, Section const &config, beast::Journal journal) |
| |
| virtual void | rotate (std::unique_ptr< NodeStore::Backend > &&newBackend, std::function< void(std::string const &writableName, std::string const &archiveName)> const &f)=0 |
| | Rotates the backends.
|
| |
| virtual std::string | getName () const =0 |
| | Retrieve the name associated with this backend.
|
| |
| virtual void | importDatabase (Database &source)=0 |
| | Import objects from another database.
|
| |
| virtual std::int32_t | getWriteLoad () const =0 |
| | Retrieve the estimated number of pending write operations.
|
| |
| virtual void | store (NodeObjectType type, Blob &&data, uint256 const &hash, std::uint32_t ledgerSeq)=0 |
| | Store the object.
|
| |
| virtual bool | isSameDB (std::uint32_t s1, std::uint32_t s2)=0 |
| |
| virtual void | sync ()=0 |
| |
| std::shared_ptr< NodeObject > | fetchNodeObject (uint256 const &hash, std::uint32_t ledgerSeq=0, FetchType fetchType=FetchType::synchronous, bool duplicate=false) |
| | Fetch a node object.
|
| |
| virtual void | asyncFetch (uint256 const &hash, std::uint32_t ledgerSeq, std::function< void(std::shared_ptr< NodeObject > const &)> &&callback) |
| | Fetch an object without waiting.
|
| |
| virtual void | sweep ()=0 |
| | Remove expired entries from the positive and negative caches.
|
| |
| std::uint64_t | getStoreCount () const |
| | Gather statistics pertaining to read and write activities.
|
| |
| std::uint32_t | getFetchTotalCount () const |
| |
| std::uint32_t | getFetchHitCount () const |
| |
| std::uint64_t | getStoreSize () const |
| |
| std::uint32_t | getFetchSize () const |
| |
| void | getCountsJson (Json::Value &obj) |
| |
| int | fdRequired () const |
| | Returns the number of file descriptors the database expects to need.
|
| |
| virtual void | stop () |
| |
| bool | isStopping () const |
| |
| std::uint32_t | earliestLedgerSeq () const noexcept |
| |
Definition at line 14 of file DatabaseRotating.h.
◆ DatabaseRotating()
◆ rotate()
Rotates the backends.
- Parameters
-
| newBackend | New writable backend |
| f | A function executed after the rotation outside of lock. The values passed to f will be the new backend database names after rotation. |
Implemented in ripple::NodeStore::DatabaseRotatingImp.
◆ getName()
| virtual std::string ripple::NodeStore::Database::getName |
( |
| ) |
const |
|
pure virtualinherited |
◆ importDatabase()
| virtual void ripple::NodeStore::Database::importDatabase |
( |
Database & |
source | ) |
|
|
pure virtualinherited |
◆ getWriteLoad()
| virtual std::int32_t ripple::NodeStore::Database::getWriteLoad |
( |
| ) |
const |
|
pure virtualinherited |
◆ store()
Store the object.
The caller's Blob parameter is overwritten.
- Parameters
-
| type | The type of object. |
| data | The payload of the object. The caller's variable is overwritten. |
| hash | The 256-bit hash of the payload data. |
| ledgerSeq | The sequence of the ledger the object belongs to. |
- Returns
true if the object was stored?
Implemented in ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.
◆ isSameDB()
◆ sync()
| virtual void ripple::NodeStore::Database::sync |
( |
| ) |
|
|
pure virtualinherited |
◆ fetchNodeObject() [1/2]
Fetch a node object.
If the object is known to be not in the database, isn't found in the database during the fetch, or failed to load correctly during the fetch, nullptr is returned.
- Note
- This can be called concurrently.
- Parameters
-
| hash | The key of the object to retrieve. |
| ledgerSeq | The sequence of the ledger where the object is stored. |
| fetchType | the type of fetch, synchronous or asynchronous. |
- Returns
- The object, or nullptr if it couldn't be retrieved.
Definition at line 221 of file Database.cpp.
◆ fetchNodeObject() [2/2]
|
|
privatepure virtualinherited |
◆ asyncFetch()
Fetch an object without waiting.
If I/O is required to determine whether or not the object is present, false is returned. Otherwise, true is returned and object is set to refer to the object, or nullptr if the object is not present. If I/O is required, the I/O is scheduled and true is returned
- Note
- This can be called concurrently.
- Parameters
-
| hash | The key of the object to retrieve |
| ledgerSeq | The sequence of the ledger where the object is stored. |
| callback | Callback function when read completes |
Reimplemented in ripple::NodeStore::DatabaseNodeImp.
Definition at line 165 of file Database.cpp.
◆ sweep()
| virtual void ripple::NodeStore::Database::sweep |
( |
| ) |
|
|
pure virtualinherited |
◆ getStoreCount()
| std::uint64_t ripple::NodeStore::Database::getStoreCount |
( |
| ) |
const |
|
inherited |
Gather statistics pertaining to read and write activities.
- Parameters
-
| obj | Json object reference into which to place counters. |
Definition at line 154 of file Database.h.
◆ getFetchTotalCount()
| std::uint32_t ripple::NodeStore::Database::getFetchTotalCount |
( |
| ) |
const |
|
inherited |
◆ getFetchHitCount()
| std::uint32_t ripple::NodeStore::Database::getFetchHitCount |
( |
| ) |
const |
|
inherited |
◆ getStoreSize()
| std::uint64_t ripple::NodeStore::Database::getStoreSize |
( |
| ) |
const |
|
inherited |
◆ getFetchSize()
| std::uint32_t ripple::NodeStore::Database::getFetchSize |
( |
| ) |
const |
|
inherited |
◆ getCountsJson()
| void ripple::NodeStore::Database::getCountsJson |
( |
Json::Value & |
obj | ) |
|
|
inherited |
◆ fdRequired()
| int ripple::NodeStore::Database::fdRequired |
( |
| ) |
const |
|
inherited |
Returns the number of file descriptors the database expects to need.
Definition at line 188 of file Database.h.
◆ stop()
| void ripple::NodeStore::Database::stop |
( |
| ) |
|
|
virtualinherited |
◆ isStopping()
| bool ripple::NodeStore::Database::isStopping |
( |
| ) |
const |
|
inherited |
◆ earliestLedgerSeq()
| std::uint32_t ripple::NodeStore::Database::earliestLedgerSeq |
( |
| ) |
const |
|
noexceptinherited |
- Returns
- The earliest ledger sequence allowed
Definition at line 202 of file Database.h.
◆ storeStats()
◆ importInternal()
| void ripple::NodeStore::Database::importInternal |
( |
Backend & |
dstBackend, |
|
|
Database & |
srcDB |
|
) |
| |
|
protectedinherited |
◆ updateFetchMetrics()
| void ripple::NodeStore::Database::updateFetchMetrics |
( |
uint64_t |
fetches, |
|
|
uint64_t |
hits, |
|
|
uint64_t |
duration |
|
) |
| |
|
protectedinherited |
◆ for_each()
|
|
privatepure virtualinherited |
◆ threadEntry()
| void ripple::NodeStore::Database::threadEntry |
( |
| ) |
|
|
privateinherited |
◆ j_
◆ scheduler_
| Scheduler& ripple::NodeStore::Database::scheduler_ |
|
protectedinherited |
◆ fdRequired_
| int ripple::NodeStore::Database::fdRequired_ {0} |
|
protectedinherited |
◆ fetchHitCount_
◆ fetchSz_
◆ earliestLedgerSeq_
| std::uint32_t const ripple::NodeStore::Database::earliestLedgerSeq_ |
|
protectedinherited |
◆ requestBundle_
| int const ripple::NodeStore::Database::requestBundle_ |
|
protectedinherited |
◆ storeCount_
◆ storeSz_
◆ fetchTotalCount_
◆ fetchDurationUs_
◆ storeDurationUs_
◆ readLock_
◆ readCondVar_
◆ read_
◆ readStopping_
| std::atomic<bool> ripple::NodeStore::Database::readStopping_ = false |
|
privateinherited |
◆ readThreads_
| std::atomic<int> ripple::NodeStore::Database::readThreads_ = 0 |
|
privateinherited |
◆ runningThreads_
| std::atomic<int> ripple::NodeStore::Database::runningThreads_ = 0 |
|
privateinherited |