#include <DatabaseRotating.h>
|
| | DatabaseRotating (Scheduler &scheduler, int readThreads, Section const &config, beast::Journal journal) |
| virtual void | rotate (std::unique_ptr< node_store::Backend > &&newBackend, std::function< void(std::string const &writableName, std::string const &archiveName)> const &f)=0 |
| | Rotates the backends.
|
| virtual void | setRotationInFlight (bool inFlight)=0 |
| | Marks an online-delete rotation as in progress (or completed).
|
| 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 |
| | Check if two ledgers are in the same database.
|
| 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 19 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 xrpl::node_store::DatabaseRotatingImp.
◆ setRotationInFlight()
| virtual void xrpl::node_store::DatabaseRotating::setRotationInFlight |
( |
bool | inFlight | ) |
|
|
pure virtual |
Marks an online-delete rotation as in progress (or completed).
While in flight, a read served by the archive backend is copied forward into the writable backend even for ordinary (duplicate == false) fetches: the archive is about to be deleted, and a node body canonicalized into caches during the rotation window would otherwise survive only in RAM once the archive is dropped.
Implemented in xrpl::node_store::DatabaseRotatingImp.
◆ getName()
| virtual std::string xrpl::node_store::Database::getName |
( |
| ) |
const |
|
pure virtualinherited |
◆ importDatabase()
| virtual void xrpl::node_store::Database::importDatabase |
( |
Database & | source | ) |
|
|
pure virtualinherited |
◆ getWriteLoad()
| virtual std::int32_t xrpl::node_store::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 xrpl::node_store::DatabaseNodeImp, and xrpl::node_store::DatabaseRotatingImp.
◆ isSameDB()
Check if two ledgers are in the same database.
If these two sequence numbers map to the same database, the result of a fetch with either sequence number would be identical.
- Parameters
-
| s1 | The first sequence number |
| s2 | The second sequence number |
- Returns
- 'true' if both ledgers would be in the same DB
Implemented in xrpl::node_store::DatabaseNodeImp, and xrpl::node_store::DatabaseRotatingImp.
◆ sync()
| virtual void xrpl::node_store::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 231 of file libxrpl/nodestore/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 xrpl::node_store::DatabaseNodeImp.
Definition at line 178 of file libxrpl/nodestore/Database.cpp.
◆ sweep()
| virtual void xrpl::node_store::Database::sweep |
( |
| ) |
|
|
pure virtualinherited |
◆ getStoreCount()
| std::uint64_t xrpl::node_store::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 171 of file Database.h.
◆ getFetchTotalCount()
| std::uint32_t xrpl::node_store::Database::getFetchTotalCount |
( |
| ) |
const |
|
inherited |
◆ getFetchHitCount()
| std::uint32_t xrpl::node_store::Database::getFetchHitCount |
( |
| ) |
const |
|
inherited |
◆ getStoreSize()
◆ getFetchSize()
◆ getCountsJson()
| void xrpl::node_store::Database::getCountsJson |
( |
json::Value & | obj | ) |
|
|
inherited |
◆ fdRequired()
| int xrpl::node_store::Database::fdRequired |
( |
| ) |
const |
|
inherited |
Returns the number of file descriptors the database expects to need.
Definition at line 207 of file Database.h.
◆ stop()
| void xrpl::node_store::Database::stop |
( |
| ) |
|
|
virtualinherited |
◆ isStopping()
| bool xrpl::node_store::Database::isStopping |
( |
| ) |
const |
|
inherited |
◆ earliestLedgerSeq()
| std::uint32_t xrpl::node_store::Database::earliestLedgerSeq |
( |
| ) |
const |
|
nodiscardnoexceptinherited |
- Returns
- The earliest ledger sequence allowed
Definition at line 222 of file Database.h.
◆ storeStats()
◆ importInternal()
| void xrpl::node_store::Database::importInternal |
( |
Backend & | dstBackend, |
|
|
Database & | srcDB ) |
|
protectedinherited |
◆ updateFetchMetrics()
| void xrpl::node_store::Database::updateFetchMetrics |
( |
uint64_t | fetches, |
|
|
uint64_t | hits, |
|
|
uint64_t | duration ) |
|
protectedinherited |
◆ forEach()
|
|
privatepure virtualinherited |
◆ threadEntry()
| void xrpl::node_store::Database::threadEntry |
( |
| ) |
|
|
privateinherited |
◆ j_
◆ scheduler_
| Scheduler& xrpl::node_store::Database::scheduler_ |
|
protectedinherited |
◆ fdRequired_
| int xrpl::node_store::Database::fdRequired_ {0} |
|
protectedinherited |
◆ fetchHitCount_
◆ fetchSz_
◆ earliestLedgerSeq_
| std::uint32_t const xrpl::node_store::Database::earliestLedgerSeq_ |
|
protectedinherited |
◆ requestBundle_
| int const xrpl::node_store::Database::requestBundle_ |
|
protectedinherited |
◆ storeCount_
◆ storeSz_
◆ fetchTotalCount_
◆ fetchDurationUs_
◆ storeDurationUs_
◆ readLock_
◆ readCondVar_
◆ read_
◆ readStopping_
| std::atomic<bool> xrpl::node_store::Database::readStopping_ = false |
|
privateinherited |
◆ readThreads_
| std::atomic<int> xrpl::node_store::Database::readThreads_ = 0 |
|
privateinherited |
◆ runningThreads_
| std::atomic<int> xrpl::node_store::Database::runningThreads_ = 0 |
|
privateinherited |