|
rippled
|


Public Member Functions | |
| DatabaseRotatingImp ()=delete | |
| DatabaseRotatingImp (DatabaseRotatingImp const &)=delete | |
| DatabaseRotatingImp & | operator= (DatabaseRotatingImp const &)=delete |
| DatabaseRotatingImp (std::string const &name, Scheduler &scheduler, int readThreads, Stoppable &parent, std::shared_ptr< Backend > writableBackend, std::shared_ptr< Backend > archiveBackend, Section const &config, beast::Journal j) | |
| ~DatabaseRotatingImp () override | |
| void | rotateWithLock (std::function< std::unique_ptr< NodeStore::Backend >(std::string const &writableBackendName)> 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 | import (Database &source) override |
| Import objects from another database. More... | |
| void | store (NodeObjectType type, Blob &&data, uint256 const &hash, std::uint32_t) override |
| Store the object. More... | |
| bool | asyncFetch (uint256 const &hash, std::uint32_t ledgerSeq, std::shared_ptr< NodeObject > &nodeObject) override |
| Fetch an object without waiting. More... | |
| bool | storeLedger (std::shared_ptr< Ledger const > const &srcLedger) override |
| Store a ledger from a different database. More... | |
| int | getDesiredAsyncReadCount (std::uint32_t) override |
| Get the maximum number of async reads the node store prefers. More... | |
| float | getCacheHitRate () override |
| Get the positive cache hits to total attempts ratio. More... | |
| void | tune (int size, std::chrono::seconds age) override |
| Set the maximum number of entries and maximum cache age for both caches. More... | |
| void | sweep () override |
| Remove expired entries from the positive and negative caches. More... | |
| TaggedCache< uint256, NodeObject > const & | getPositiveCache () override |
| std::shared_ptr< NodeObject > | fetchNodeObject (uint256 const &hash, std::uint32_t ledgerSeq=0, FetchType fetchType=FetchType::synchronous) |
| Fetch a node object. More... | |
| void | waitReads () |
| Wait for all currently pending async reads to complete. 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 |
| int | fdRequired () const |
| Returns the number of file descriptors the database expects to need. More... | |
| void | onStop () override |
| Override called when the stop notification is issued. More... | |
| void | onChildrenStopped () override |
| Override called when all children have stopped. More... | |
| std::uint32_t | earliestLedgerSeq () const |
| RootStoppable & | getRoot () |
| void | setParent (Stoppable &parent) |
| Set the parent of this Stoppable. More... | |
| bool | isStopping () const |
Returns true if the stoppable should stop. More... | |
| bool | isStopped () const |
Returns true if the requested stop has completed. More... | |
| bool | areChildrenStopped () const |
Returns true if all children have stopped. More... | |
| JobCounter & | jobCounter () |
| bool | alertable_sleep_until (std::chrono::system_clock::time_point const &t) |
| Sleep or wake up on stop. More... | |
Protected Member Functions | |
| void | asyncFetch (uint256 const &hash, std::uint32_t ledgerSeq) |
| bool | storeLedger (Ledger const &srcLedger, std::shared_ptr< Backend > dstBackend, std::shared_ptr< TaggedCache< uint256, NodeObject >> dstPCache, std::shared_ptr< KeyCache< uint256 >> dstNCache) |
| void | stopReadThreads () |
| void | storeStats (std::uint64_t count, std::uint64_t sz) |
| void | importInternal (Backend &dstBackend, Database &srcDB) |
| void | stopped () |
| Called by derived classes to indicate that the stoppable has stopped. More... | |
Protected Attributes | |
| const beast::Journal | j_ |
| Scheduler & | scheduler_ |
| int | fdRequired_ {0} |
| std::atomic< std::uint32_t > | fetchHitCount_ {0} |
| std::atomic< std::uint32_t > | fetchSz_ {0} |
Private Types | |
| using | Children = beast::LockFreeStack< Child > |
Private Member Functions | |
| std::shared_ptr< NodeObject > | fetchNodeObject (uint256 const &hash, std::uint32_t, FetchReport &fetchReport) 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 () |
| virtual void | onPrepare () |
| Override called during preparation. More... | |
| virtual void | onStart () |
| Override called during start. More... | |
| void | prepareRecursive () |
| void | startRecursive () |
| void | stopAsyncRecursive (beast::Journal j) |
| void | stopRecursive (beast::Journal j) |
Private Attributes | |
| std::shared_ptr< TaggedCache< uint256, NodeObject > > | pCache_ |
| std::shared_ptr< KeyCache< uint256 > > | nCache_ |
| 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::mutex | readLock_ |
| std::condition_variable | readCondVar_ |
| std::condition_variable | readGenCondVar_ |
| std::map< uint256, std::uint32_t > | read_ |
| uint256 | readLastHash_ |
| std::vector< std::thread > | readThreads_ |
| bool | readShut_ {false} |
| uint64_t | readGen_ {0} |
| const std::uint32_t | earliestLedgerSeq_ |
| std::string | m_name |
| RootStoppable & | m_root |
| Child | m_child |
| std::atomic< bool > | m_stopped {false} |
| std::atomic< bool > | m_childrenStopped {false} |
| Children | m_children |
| std::condition_variable | m_cv |
| std::mutex | m_mut |
| bool | m_is_stopping = false |
| bool | hasParent_ {false} |
Definition at line 28 of file DatabaseRotatingImp.h.
|
privateinherited |
Definition at line 319 of file Stoppable.h.
|
delete |
|
delete |
| ripple::NodeStore::DatabaseRotatingImp::DatabaseRotatingImp | ( | std::string const & | name, |
| Scheduler & | scheduler, | ||
| int | readThreads, | ||
| Stoppable & | parent, | ||
| std::shared_ptr< Backend > | writableBackend, | ||
| std::shared_ptr< Backend > | archiveBackend, | ||
| Section const & | config, | ||
| beast::Journal | j | ||
| ) |
Definition at line 27 of file DatabaseRotatingImp.cpp.
|
override |
Definition at line 46 of file DatabaseRotatingImp.h.
|
delete |
|
overridevirtual |
Rotates the backends.
| f | A function executed before the rotation and under the same lock |
Implements ripple::NodeStore::DatabaseRotating.
Definition at line 59 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 |
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 108 of file DatabaseRotatingImp.cpp.
|
overridevirtual |
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.
| hash | The key of the object to retrieve |
| ledgerSeq | The sequence of the ledger where the object is stored, used by the shard store. |
| nodeObject | The object retrieved |
Implements ripple::NodeStore::Database.
Definition at line 128 of file DatabaseRotatingImp.cpp.
|
overridevirtual |
Store a ledger from a different database.
| srcLedger | The ledger to store. |
Implements ripple::NodeStore::Database.
Definition at line 97 of file DatabaseRotatingImp.cpp.
|
overridevirtual |
Get the maximum number of async reads the node store prefers.
| ledgerSeq | A ledger sequence specifying a shard to query. |
Implements ripple::NodeStore::Database.
Definition at line 79 of file DatabaseRotatingImp.h.
|
overridevirtual |
Get the positive cache hits to total attempts ratio.
Implements ripple::NodeStore::Database.
Definition at line 88 of file DatabaseRotatingImp.h.
|
overridevirtual |
Set the maximum number of entries and maximum cache age for both caches.
| size | Number of cache entries (0 = ignore) |
| age | Maximum cache age in seconds |
Implements ripple::NodeStore::Database.
Definition at line 144 of file DatabaseRotatingImp.cpp.
|
overridevirtual |
Remove expired entries from the positive and negative caches.
Implements ripple::NodeStore::Database.
Definition at line 153 of file DatabaseRotatingImp.cpp.
|
overridevirtual |
Implements ripple::NodeStore::DatabaseRotating.
Definition at line 100 of file DatabaseRotatingImp.h.
|
overrideprivatevirtual |
Implements ripple::NodeStore::Database.
Definition at line 160 of file DatabaseRotatingImp.cpp.
|
overrideprivatevirtual |
Visit every object in the database This is usually called during import.
Implements ripple::NodeStore::Database.
Definition at line 253 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 158 of file Database.cpp.
|
protectedinherited |
Definition at line 110 of file Database.cpp.
|
protectedinherited |
Definition at line 184 of file Database.cpp.
|
inherited |
Wait for all currently pending async reads to complete.
Definition at line 61 of file Database.cpp.
|
inherited |
Gather statistics pertaining to read and write activities.
Definition at line 196 of file Database.h.
|
inherited |
Definition at line 202 of file Database.h.
|
inherited |
Definition at line 208 of file Database.h.
|
inherited |
Definition at line 214 of file Database.h.
|
inherited |
Definition at line 220 of file Database.h.
|
inherited |
Returns the number of file descriptors the database expects to need.
Definition at line 227 of file Database.h.
|
overridevirtualinherited |
Override called when the stop notification is issued.
The call is made on an unspecified, implementation-specific thread. onStop and onChildrenStopped will never be called concurrently, across all Stoppable objects descended from the same root, inclusive of the root.
It is safe to call isStopping, isStopped, and areChildrenStopped from within this function; The values returned will always be valid and never change during the callback.
The default implementation simply calls stopped(). This is applicable when the Stoppable has a trivial stop operation (or no stop operation), and we are merely using the Stoppable API to position it as a dependency of some parent service.
Thread safety: May not block for long periods. Guaranteed only to be called once. Must be safe to call from any thread at any time.
Reimplemented from ripple::Stoppable.
Reimplemented in ripple::NodeStore::DatabaseShardImp.
Definition at line 79 of file Database.cpp.
|
overridevirtualinherited |
Override called when all children have stopped.
The call is made on an unspecified, implementation-specific thread. onStop and onChildrenStopped will never be called concurrently, across all Stoppable objects descended from the same root, inclusive of the root.
It is safe to call isStopping, isStopped, and areChildrenStopped from within this function; The values returned will always be valid and never change during the callback.
The default implementation does nothing.
Thread safety: May not block for long periods. Guaranteed only to be called once. Must be safe to call from any thread at any time.
Reimplemented from ripple::Stoppable.
Reimplemented in ripple::NodeStore::DatabaseShardImp.
Definition at line 87 of file Database.cpp.
|
inherited |
Definition at line 241 of file Database.h.
|
protectedinherited |
Definition at line 93 of file Database.cpp.
|
protectedinherited |
Definition at line 258 of file Database.h.
|
protectedinherited |
Definition at line 119 of file Database.cpp.
|
privateinherited |
Definition at line 293 of file Database.cpp.
|
inherited |
Definition at line 214 of file Stoppable.h.
|
inherited |
Set the parent of this Stoppable.
Definition at line 43 of file Stoppable.cpp.
|
inherited |
Returns true if the stoppable should stop.
Definition at line 54 of file Stoppable.cpp.
|
inherited |
Returns true if the requested stop has completed.
Definition at line 60 of file Stoppable.cpp.
|
inherited |
Returns true if all children have stopped.
Definition at line 66 of file Stoppable.cpp.
|
inherited |
Definition at line 437 of file Stoppable.h.
|
inherited |
Sleep or wake up on stop.
true if we are stopping Definition at line 455 of file Stoppable.h.
|
protectedinherited |
Called by derived classes to indicate that the stoppable has stopped.
Definition at line 72 of file Stoppable.cpp.
|
privatevirtualinherited |
Override called during preparation.
Since all other Stoppable objects in the tree have already been constructed, this provides an opportunity to perform initialization which depends on calling into other Stoppable objects. This call is made on the same thread that called prepare(). The default implementation does nothing. Guaranteed to only be called once.
Reimplemented in ripple::ApplicationImp, ripple::OverlayImpl, ripple::test::Stoppable_test::Root, ripple::test::Stoppable_test::C, ripple::test::Stoppable_test::I, ripple::test::Stoppable_test::B, ripple::test::Stoppable_test::H, ripple::test::Stoppable_test::G, ripple::SHAMapStoreImp, ripple::test::Stoppable_test::A, ripple::PeerFinder::ManagerImp, ripple::perf::PerfLogImp, ripple::test::Stoppable_test::F, ripple::test::Stoppable_test::E, ripple::detail::LedgerCleanerImp, ripple::test::Stoppable_test::J, ripple::LoadManager, ripple::PerfLog_test::PerfLogParent, and ripple::test::Stoppable_test::D.
Definition at line 80 of file Stoppable.cpp.
|
privatevirtualinherited |
Override called during start.
Reimplemented in ripple::ApplicationImp, ripple::OverlayImpl, ripple::test::Stoppable_test::Root, ripple::test::Stoppable_test::C, ripple::test::Stoppable_test::I, ripple::test::Stoppable_test::B, ripple::test::Stoppable_test::H, ripple::test::Stoppable_test::G, ripple::SHAMapStoreImp, ripple::GRPCServer, ripple::test::Stoppable_test::A, ripple::PeerFinder::ManagerImp, ripple::perf::PerfLogImp, ripple::test::Stoppable_test::F, ripple::test::Stoppable_test::E, ripple::detail::LedgerCleanerImp, ripple::test::Stoppable_test::J, ripple::LoadManager, ripple::PerfLog_test::PerfLogParent, and ripple::test::Stoppable_test::D.
Definition at line 85 of file Stoppable.cpp.
|
privateinherited |
Definition at line 103 of file Stoppable.cpp.
|
privateinherited |
Definition at line 113 of file Stoppable.cpp.
|
privateinherited |
Definition at line 123 of file Stoppable.cpp.
|
privateinherited |
Definition at line 134 of file Stoppable.cpp.
|
private |
Definition at line 107 of file DatabaseRotatingImp.h.
|
private |
Definition at line 110 of file DatabaseRotatingImp.h.
|
private |
Definition at line 112 of file DatabaseRotatingImp.h.
|
private |
Definition at line 113 of file DatabaseRotatingImp.h.
|
mutableprivate |
Definition at line 114 of file DatabaseRotatingImp.h.
|
protectedinherited |
Definition at line 247 of file Database.h.
|
protectedinherited |
Definition at line 248 of file Database.h.
|
protectedinherited |
Definition at line 249 of file Database.h.
|
protectedinherited |
Definition at line 251 of file Database.h.
|
protectedinherited |
Definition at line 252 of file Database.h.
|
privateinherited |
Definition at line 282 of file Database.h.
|
privateinherited |
Definition at line 283 of file Database.h.
|
privateinherited |
Definition at line 284 of file Database.h.
|
privateinherited |
Definition at line 286 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 291 of file Database.h.
|
privateinherited |
Definition at line 294 of file Database.h.
|
privateinherited |
Definition at line 296 of file Database.h.
|
privateinherited |
Definition at line 297 of file Database.h.
|
privateinherited |
Definition at line 300 of file Database.h.
|
privateinherited |
Definition at line 304 of file Database.h.
|
privateinherited |
Definition at line 339 of file Stoppable.h.
|
privateinherited |
Definition at line 340 of file Stoppable.h.
|
privateinherited |
Definition at line 341 of file Stoppable.h.
|
privateinherited |
Definition at line 342 of file Stoppable.h.
|
privateinherited |
Definition at line 343 of file Stoppable.h.
|
privateinherited |
Definition at line 344 of file Stoppable.h.
|
privateinherited |
Definition at line 345 of file Stoppable.h.
|
privateinherited |
Definition at line 346 of file Stoppable.h.
|
privateinherited |
Definition at line 347 of file Stoppable.h.
|
privateinherited |
Definition at line 348 of file Stoppable.h.
1.8.17