#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]
| xrpl::NodeStore::DatabaseRotatingImp::DatabaseRotatingImp |
( |
| ) |
|
|
delete |
◆ DatabaseRotatingImp() [2/3]
◆ DatabaseRotatingImp() [3/3]
◆ ~DatabaseRotatingImp()
| xrpl::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 xrpl::NodeStore::DatabaseRotating.
Definition at line 24 of file DatabaseRotatingImp.cpp.
◆ getName()
| std::string xrpl::NodeStore::DatabaseRotatingImp::getName |
( |
| ) |
const |
|
overridevirtual |
◆ getWriteLoad()
| std::int32_t xrpl::NodeStore::DatabaseRotatingImp::getWriteLoad |
( |
| ) |
const |
|
overridevirtual |
◆ importDatabase()
| void xrpl::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 xrpl::NodeStore::Database.
Definition at line 85 of file DatabaseRotatingImp.cpp.
◆ sync()
| void xrpl::NodeStore::DatabaseRotatingImp::sync |
( |
| ) |
|
|
overridevirtual |
◆ sweep()
| void xrpl::NodeStore::DatabaseRotatingImp::sweep |
( |
| ) |
|
|
overridevirtual |
◆ fetchNodeObject() [1/2]
◆ for_each()
Visit every object in the database This is usually called during import.
- Note
- This routine will not be called concurrently with itself or other methods.
- See also
- import
Implements xrpl::NodeStore::Database.
Definition at line 179 of file DatabaseRotatingImp.cpp.
◆ 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 xrpl::NodeStore::DatabaseNodeImp.
Definition at line 165 of file Database.cpp.
◆ getStoreCount()
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 xrpl::NodeStore::Database::getFetchTotalCount |
( |
| ) |
const |
|
inherited |
◆ getFetchHitCount()
| std::uint32_t xrpl::NodeStore::Database::getFetchHitCount |
( |
| ) |
const |
|
inherited |
◆ getStoreSize()
◆ getFetchSize()
◆ getCountsJson()
| void xrpl::NodeStore::Database::getCountsJson |
( |
Json::Value & |
obj | ) |
|
|
inherited |
◆ fdRequired()
| int xrpl::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 xrpl::NodeStore::Database::stop |
( |
| ) |
|
|
virtualinherited |
◆ isStopping()
| bool xrpl::NodeStore::Database::isStopping |
( |
| ) |
const |
|
inherited |
◆ earliestLedgerSeq()
| std::uint32_t xrpl::NodeStore::Database::earliestLedgerSeq |
( |
| ) |
const |
|
noexceptinherited |
- Returns
- The earliest ledger sequence allowed
Definition at line 202 of file Database.h.
◆ storeStats()
◆ importInternal()
| void xrpl::NodeStore::Database::importInternal |
( |
Backend & |
dstBackend, |
|
|
Database & |
srcDB |
|
) |
| |
|
protectedinherited |
◆ updateFetchMetrics()
| void xrpl::NodeStore::Database::updateFetchMetrics |
( |
uint64_t |
fetches, |
|
|
uint64_t |
hits, |
|
|
uint64_t |
duration |
|
) |
| |
|
protectedinherited |
◆ threadEntry()
| void xrpl::NodeStore::Database::threadEntry |
( |
| ) |
|
|
privateinherited |
◆ writableBackend_
◆ archiveBackend_
◆ mutex_
| std::mutex xrpl::NodeStore::DatabaseRotatingImp::mutex_ |
|
mutableprivate |
◆ j_
◆ scheduler_
| Scheduler& xrpl::NodeStore::Database::scheduler_ |
|
protectedinherited |
◆ fdRequired_
| int xrpl::NodeStore::Database::fdRequired_ {0} |
|
protectedinherited |
◆ fetchHitCount_
◆ fetchSz_
◆ earliestLedgerSeq_
| std::uint32_t const xrpl::NodeStore::Database::earliestLedgerSeq_ |
|
protectedinherited |
◆ requestBundle_
| int const xrpl::NodeStore::Database::requestBundle_ |
|
protectedinherited |
◆ storeCount_
◆ storeSz_
◆ fetchTotalCount_
◆ fetchDurationUs_
◆ storeDurationUs_
◆ readLock_
◆ readCondVar_
◆ read_
◆ readStopping_
| std::atomic<bool> xrpl::NodeStore::Database::readStopping_ = false |
|
privateinherited |
◆ readThreads_
| std::atomic<int> xrpl::NodeStore::Database::readThreads_ = 0 |
|
privateinherited |
◆ runningThreads_
| std::atomic<int> xrpl::NodeStore::Database::runningThreads_ = 0 |
|
privateinherited |