|
rippled
|
#include <DatabaseRotatingImp.h>


Public Member Functions | |
| 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. More... | |
| std::string | getName () const override |
| Retrieve the name associated with this backend. More... | |
| std::int32_t | getWriteLoad () const override |
| Retrieve the estimated number of pending write operations. More... | |
| void | importDatabase (Database &source) override |
| Import objects from another database. More... | |
| 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. More... | |
| void | sync () override |
| void | sweep () override |
| Remove expired entries from the positive and negative caches. More... | |
| std::shared_ptr< NodeObject > | fetchNodeObject (uint256 const &hash, std::uint32_t ledgerSeq=0, FetchType fetchType=FetchType::synchronous, bool duplicate=false) |
| Fetch a node object. More... | |
| virtual void | asyncFetch (uint256 const &hash, std::uint32_t ledgerSeq, std::function< void(std::shared_ptr< NodeObject > const &)> &&callback) |
| Fetch an object without waiting. More... | |
| std::uint64_t | getStoreCount () const |
| Gather statistics pertaining to read and write activities. More... | |
| 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. More... | |
| virtual void | stop () |
| bool | isStopping () const |
| std::uint32_t | earliestLedgerSeq () const noexcept |
Protected Member Functions | |
| void | storeStats (std::uint64_t count, std::uint64_t sz) |
| void | importInternal (Backend &dstBackend, Database &srcDB) |
| void | updateFetchMetrics (uint64_t fetches, uint64_t hits, uint64_t duration) |
Protected Attributes | |
| beast::Journal const | j_ |
| Scheduler & | scheduler_ |
| int | fdRequired_ {0} |
| std::atomic< std::uint32_t > | fetchHitCount_ {0} |
| std::atomic< std::uint32_t > | fetchSz_ {0} |
| std::uint32_t const | earliestLedgerSeq_ |
| int const | requestBundle_ |
Private Member Functions | |
| std::shared_ptr< NodeObject > | fetchNodeObject (uint256 const &hash, std::uint32_t, FetchReport &fetchReport, bool duplicate) override |
| void | for_each (std::function< void(std::shared_ptr< NodeObject >)> f) override |
| Visit every object in the database This is usually called during import. More... | |
| void | threadEntry () |
Private Attributes | |
| std::shared_ptr< Backend > | writableBackend_ |
| std::shared_ptr< Backend > | archiveBackend_ |
| std::mutex | mutex_ |
| std::atomic< std::uint64_t > | storeCount_ {0} |
| std::atomic< std::uint64_t > | storeSz_ {0} |
| std::atomic< std::uint64_t > | fetchTotalCount_ {0} |
| std::atomic< std::uint64_t > | fetchDurationUs_ {0} |
| std::atomic< std::uint64_t > | storeDurationUs_ {0} |
| std::mutex | readLock_ |
| std::condition_variable | readCondVar_ |
| std::map< uint256, std::vector< std::pair< std::uint32_t, std::function< void(std::shared_ptr< NodeObject > const &)> > > > | read_ |
| std::atomic< bool > | readStopping_ = false |
| std::atomic< int > | readThreads_ = 0 |
| std::atomic< int > | runningThreads_ = 0 |
Definition at line 30 of file DatabaseRotatingImp.h.
|
delete |
|
delete |
| ripple::NodeStore::DatabaseRotatingImp::DatabaseRotatingImp | ( | Scheduler & | scheduler, |
| int | readThreads, | ||
| std::shared_ptr< Backend > | writableBackend, | ||
| std::shared_ptr< Backend > | archiveBackend, | ||
| Section const & | config, | ||
| beast::Journal | j | ||
| ) |
Definition at line 25 of file DatabaseRotatingImp.cpp.
| ripple::NodeStore::DatabaseRotatingImp::~DatabaseRotatingImp | ( | ) |
Definition at line 46 of file DatabaseRotatingImp.h.
|
delete |
|
overridevirtual |
Rotates the backends.
| 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 43 of file DatabaseRotatingImp.cpp.
|
overridevirtual |
Retrieve the name associated with this backend.
This is used for diagnostics and may not reflect the actual path or paths used by the underlying backend.
Implements ripple::NodeStore::Database.
Definition at line 72 of file DatabaseRotatingImp.cpp.
|
overridevirtual |
Retrieve the estimated number of pending write operations.
This is used for diagnostics.
Implements ripple::NodeStore::Database.
Definition at line 79 of file DatabaseRotatingImp.cpp.
|
overridevirtual |
Import objects from another database.
Implements ripple::NodeStore::Database.
Definition at line 86 of file DatabaseRotatingImp.cpp.
|
overridevirtual |
Implements ripple::NodeStore::Database.
Definition at line 68 of file DatabaseRotatingImp.h.
|
overridevirtual |
Store the object.
The caller's Blob parameter is overwritten.
| 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. |
true if the object was stored? Implements ripple::NodeStore::Database.
Definition at line 104 of file DatabaseRotatingImp.cpp.
|
overridevirtual |
Implements ripple::NodeStore::Database.
Definition at line 97 of file DatabaseRotatingImp.cpp.
|
overridevirtual |
Remove expired entries from the positive and negative caches.
Implements ripple::NodeStore::Database.
Definition at line 122 of file DatabaseRotatingImp.cpp.
|
overrideprivatevirtual |
Implements ripple::NodeStore::Database.
Definition at line 128 of file DatabaseRotatingImp.cpp.
|
overrideprivatevirtual |
Visit every object in the database This is usually called during import.
Implements ripple::NodeStore::Database.
Definition at line 198 of file DatabaseRotatingImp.cpp.
|
inherited |
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.
| 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. |
Definition at line 241 of file Database.cpp.
|
virtualinherited |
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
| 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 185 of file Database.cpp.
|
inherited |
Gather statistics pertaining to read and write activities.
| obj | Json object reference into which to place counters. |
Definition at line 173 of file Database.h.
|
inherited |
Definition at line 179 of file Database.h.
|
inherited |
Definition at line 185 of file Database.h.
|
inherited |
Definition at line 191 of file Database.h.
|
inherited |
Definition at line 197 of file Database.h.
|
inherited |
Definition at line 268 of file Database.cpp.
|
inherited |
Returns the number of file descriptors the database expects to need.
Definition at line 207 of file Database.h.
|
virtualinherited |
Definition at line 150 of file Database.cpp.
|
inherited |
Definition at line 144 of file Database.cpp.
|
noexceptinherited |
Definition at line 221 of file Database.h.
|
protectedinherited |
Definition at line 248 of file Database.h.
|
protectedinherited |
Definition at line 200 of file Database.cpp.
|
protectedinherited |
Definition at line 262 of file Database.h.
|
privateinherited |
|
private |
Definition at line 85 of file DatabaseRotatingImp.h.
|
private |
Definition at line 86 of file DatabaseRotatingImp.h.
|
mutableprivate |
Definition at line 87 of file DatabaseRotatingImp.h.
|
protectedinherited |
Definition at line 227 of file Database.h.
|
protectedinherited |
Definition at line 228 of file Database.h.
|
protectedinherited |
Definition at line 229 of file Database.h.
|
protectedinherited |
Definition at line 231 of file Database.h.
|
protectedinherited |
Definition at line 232 of file Database.h.
|
protectedinherited |
Definition at line 240 of file Database.h.
|
protectedinherited |
Definition at line 245 of file Database.h.
|
privateinherited |
Definition at line 270 of file Database.h.
|
privateinherited |
Definition at line 271 of file Database.h.
|
privateinherited |
Definition at line 272 of file Database.h.
|
privateinherited |
Definition at line 273 of file Database.h.
|
privateinherited |
Definition at line 274 of file Database.h.
|
mutableprivateinherited |
Definition at line 276 of file Database.h.
|
privateinherited |
Definition at line 277 of file Database.h.
|
privateinherited |
Definition at line 285 of file Database.h.
|
privateinherited |
Definition at line 287 of file Database.h.
|
privateinherited |
Definition at line 288 of file Database.h.
|
privateinherited |
Definition at line 289 of file Database.h.