#include <DatabaseRotatingImp.h>
|
| | DatabaseRotatingImp ()=delete |
| |
| | DatabaseRotatingImp (DatabaseRotatingImp const &)=delete |
| |
| DatabaseRotatingImp & | operator= (DatabaseRotatingImp const &)=delete |
| |
| | DatabaseRotatingImp (Scheduler &scheduler, int readThreads, std::shared_ptr< Backend > writableBackend, std::shared_ptr< Backend > archiveBackend, Section const &config, beast::Journal j) |
| |
| | ~DatabaseRotatingImp () |
| |
| void | rotate (std::unique_ptr< NodeStore::Backend > &&newBackend, std::function< void(std::string const &writableName, std::string const &archiveName)> const &f) override |
| | Rotates the backends.
|
| |
| std::string | getName () const override |
| | Retrieve the name associated with this backend.
|
| |
| std::int32_t | getWriteLoad () const override |
| | Retrieve the estimated number of pending write operations.
|
| |
| void | importDatabase (Database &source) override |
| | Import objects from another database.
|
| |
| bool | isSameDB (std::uint32_t, std::uint32_t) override |
| |
| void | store (NodeObjectType type, Blob &&data, uint256 const &hash, std::uint32_t) override |
| | Store the object.
|
| |
| void | sync () override |
| |
| void | sweep () override |
| | Remove expired entries from the positive and negative caches.
|
| |
| 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.
|
| |
| 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 11 of file DatabaseRotatingImp.h.
◆ DatabaseRotatingImp() [1/3]
| ripple::NodeStore::DatabaseRotatingImp::DatabaseRotatingImp |
( |
| ) |
|
|
delete |
◆ DatabaseRotatingImp() [2/3]
◆ DatabaseRotatingImp() [3/3]
◆ ~DatabaseRotatingImp()
| ripple::NodeStore::DatabaseRotatingImp::~DatabaseRotatingImp |
( |
| ) |
|
◆ operator=()
◆ 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. |
Implements ripple::NodeStore::DatabaseRotating.
Definition at line 24 of file DatabaseRotatingImp.cpp.
◆ getName()
| std::string ripple::NodeStore::DatabaseRotatingImp::getName |
( |
| ) |
const |
|
overridevirtual |
◆ getWriteLoad()
| std::int32_t ripple::NodeStore::DatabaseRotatingImp::getWriteLoad |
( |
| ) |
const |
|
overridevirtual |
◆ importDatabase()
| void ripple::NodeStore::DatabaseRotatingImp::importDatabase |
( |
Database & |
source | ) |
|
|
overridevirtual |
◆ isSameDB()
◆ 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?
Implements ripple::NodeStore::Database.
Definition at line 85 of file DatabaseRotatingImp.cpp.
◆ sync()
| void ripple::NodeStore::DatabaseRotatingImp::sync |
( |
| ) |
|
|
overridevirtual |
◆ sweep()
| void ripple::NodeStore::DatabaseRotatingImp::sweep |
( |
| ) |
|
|
overridevirtual |
◆ fetchNodeObject() [1/2]
◆ for_each()
◆ fetchNodeObject() [2/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.
◆ 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.
◆ 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 |
◆ threadEntry()
| void ripple::NodeStore::Database::threadEntry |
( |
| ) |
|
|
privateinherited |
◆ writableBackend_
◆ archiveBackend_
◆ mutex_
| std::mutex ripple::NodeStore::DatabaseRotatingImp::mutex_ |
|
mutableprivate |
◆ 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 |