|
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... | |
| 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... | |
| bool | storeLedger (std::shared_ptr< Ledger const > const &srcLedger) override |
| Store a ledger from a different database. More... | |
| 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) |
| Fetch a node object. More... | |
| 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 |
| 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) |
| 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< 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::map< uint256, std::vector< std::pair< std::uint32_t, std::function< void(std::shared_ptr< NodeObject > const &)> > > > | read_ |
| uint256 | readLastHash_ |
| std::vector< std::thread > | readThreads_ |
| bool | readShut_ {false} |
| 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 48 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 61 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 68 of file DatabaseRotatingImp.cpp.
|
overridevirtual |
Import objects from another database.
Implements ripple::NodeStore::Database.
Definition at line 75 of file DatabaseRotatingImp.cpp.
|
overridevirtual |
Implements ripple::NodeStore::Database.
Definition at line 66 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 97 of file DatabaseRotatingImp.cpp.
|
overridevirtual |
Store a ledger from a different database.
| srcLedger | The ledger to store. |
Implements ripple::NodeStore::Database.
Definition at line 86 of file DatabaseRotatingImp.cpp.
|
overridevirtual |
Remove expired entries from the positive and negative caches.
Implements ripple::NodeStore::Database.
Definition at line 115 of file DatabaseRotatingImp.cpp.
|
overrideprivatevirtual |
Implements ripple::NodeStore::Database.
Definition at line 121 of file DatabaseRotatingImp.cpp.
|
overrideprivatevirtual |
Visit every object in the database This is usually called during import.
Implements ripple::NodeStore::Database.
Definition at line 193 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 142 of file Database.cpp.
|
inherited |
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, used by the shard store. |
| callback | Callback function when read completes |
Definition at line 91 of file Database.cpp.
|
protectedinherited |
|
protectedinherited |
Definition at line 167 of file Database.cpp.
|
inherited |
Gather statistics pertaining to read and write activities.
Definition at line 183 of file Database.h.
|
inherited |
Definition at line 189 of file Database.h.
|
inherited |
Definition at line 195 of file Database.h.
|
inherited |
Definition at line 201 of file Database.h.
|
inherited |
Definition at line 207 of file Database.h.
|
inherited |
Returns the number of file descriptors the database expects to need.
Definition at line 214 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 61 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 69 of file Database.cpp.
|
inherited |
Definition at line 228 of file Database.h.
|
protectedinherited |
Definition at line 75 of file Database.cpp.
|
protectedinherited |
Definition at line 245 of file Database.h.
|
protectedinherited |
Definition at line 103 of file Database.cpp.
|
privateinherited |
Definition at line 267 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 420 of file Stoppable.h.
|
inherited |
Sleep or wake up on stop.
true if we are stopping Definition at line 440 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::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::test::Stoppable_test::A, ripple::PeerFinder::ManagerImp, ripple::test::Stoppable_test::F, ripple::test::Stoppable_test::E, ripple::test::Stoppable_test::J, 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::perf::PerfLogImp, ripple::test::Stoppable_test::F, ripple::test::Stoppable_test::E, ripple::test::Stoppable_test::J, ripple::detail::LedgerCleanerImp, 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 83 of file DatabaseRotatingImp.h.
|
private |
Definition at line 84 of file DatabaseRotatingImp.h.
|
mutableprivate |
Definition at line 85 of file DatabaseRotatingImp.h.
|
protectedinherited |
Definition at line 234 of file Database.h.
|
protectedinherited |
Definition at line 235 of file Database.h.
|
protectedinherited |
Definition at line 236 of file Database.h.
|
protectedinherited |
Definition at line 238 of file Database.h.
|
protectedinherited |
Definition at line 239 of file Database.h.
|
privateinherited |
Definition at line 265 of file Database.h.
|
privateinherited |
Definition at line 266 of file Database.h.
|
privateinherited |
Definition at line 267 of file Database.h.
|
privateinherited |
Definition at line 269 of file Database.h.
|
privateinherited |
Definition at line 270 of file Database.h.
|
privateinherited |
Definition at line 278 of file Database.h.
|
privateinherited |
Definition at line 281 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 288 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 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.
|
privateinherited |
Definition at line 349 of file Stoppable.h.
1.8.17