|
rippled
|


Public Member Functions | |
| DatabaseRotating (std::string const &name, Stoppable &parent, Scheduler &scheduler, int readThreads, Section const &config, beast::Journal journal) | |
| virtual TaggedCache< uint256, NodeObject > const & | getPositiveCache ()=0 |
| virtual void | rotateWithLock (std::function< std::unique_ptr< NodeStore::Backend >(std::string const &writableBackendName)> const &f)=0 |
| Rotates the backends. More... | |
| virtual std::string | getName () const =0 |
| Retrieve the name associated with this backend. More... | |
| virtual void | import (Database &source)=0 |
| Import objects from another database. More... | |
| virtual std::int32_t | getWriteLoad () const =0 |
| Retrieve the estimated number of pending write operations. More... | |
| virtual void | store (NodeObjectType type, Blob &&data, uint256 const &hash, std::uint32_t seq)=0 |
| Store the object. More... | |
| virtual std::shared_ptr< NodeObject > | fetch (uint256 const &hash, std::uint32_t seq)=0 |
| Fetch an object. More... | |
| virtual bool | asyncFetch (uint256 const &hash, std::uint32_t seq, std::shared_ptr< NodeObject > &object)=0 |
| Fetch an object without waiting. More... | |
| virtual bool | storeLedger (std::shared_ptr< Ledger const > const &srcLedger)=0 |
| Copies a ledger stored in a different database to this one. More... | |
| void | waitReads () |
| Wait for all currently pending async reads to complete. More... | |
| virtual int | getDesiredAsyncReadCount (std::uint32_t seq)=0 |
| Get the maximum number of async reads the node store prefers. More... | |
| virtual float | getCacheHitRate ()=0 |
| Get the positive cache hits to total attempts ratio. More... | |
| virtual void | tune (int size, std::chrono::seconds age)=0 |
| Set the maximum number of entries and maximum cache age for both caches. More... | |
| virtual void | sweep ()=0 |
| Remove expired entries from the positive and negative caches. More... | |
| std::uint32_t | getStoreCount () const |
| Gather statistics pertaining to read and write activities. More... | |
| std::uint32_t | getFetchTotalCount () const |
| std::uint32_t | getFetchHitCount () const |
| std::uint32_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 seq, std::shared_ptr< TaggedCache< uint256, NodeObject >> const &pCache, std::shared_ptr< KeyCache< uint256 >> const &nCache) |
| bool | storeLedger (Ledger const &srcLedger, std::shared_ptr< Backend > dstBackend, std::shared_ptr< TaggedCache< uint256, NodeObject >> dstPCache, std::shared_ptr< KeyCache< uint256 >> dstNCache, std::shared_ptr< Ledger const > next) |
| void | stopThreads () |
| void | storeStats (size_t sz) |
| std::shared_ptr< NodeObject > | fetchInternal (uint256 const &hash, std::shared_ptr< Backend > backend) |
| void | importInternal (Backend &dstBackend, Database &srcDB) |
| std::shared_ptr< NodeObject > | doFetch (uint256 const &hash, std::uint32_t seq, TaggedCache< uint256, NodeObject > &pCache, KeyCache< uint256 > &nCache, bool isAsync) |
| 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} |
Private Types | |
| using | Children = beast::LockFreeStack< Child > |
Private Member Functions | |
| virtual std::shared_ptr< NodeObject > | fetchFrom (uint256 const &hash, std::uint32_t seq)=0 |
| virtual void | for_each (std::function< void(std::shared_ptr< NodeObject >)> f)=0 |
| 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::atomic< std::uint32_t > | storeCount_ {0} |
| std::atomic< std::uint32_t > | fetchTotalCount_ {0} |
| std::atomic< std::uint32_t > | fetchHitCount_ {0} |
| std::atomic< std::uint32_t > | storeSz_ {0} |
| std::atomic< std::uint32_t > | fetchSz_ {0} |
| std::mutex | readLock_ |
| std::condition_variable | readCondVar_ |
| std::condition_variable | readGenCondVar_ |
| std::map< uint256, std::tuple< std::uint32_t, std::weak_ptr< TaggedCache< uint256, NodeObject > >, std::weak_ptr< KeyCache< uint256 > > > > | 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 33 of file DatabaseRotating.h.
|
privateinherited |
Definition at line 318 of file Stoppable.h.
| ripple::NodeStore::DatabaseRotating::DatabaseRotating | ( | std::string const & | name, |
| Stoppable & | parent, | ||
| Scheduler & | scheduler, | ||
| int | readThreads, | ||
| Section const & | config, | ||
| beast::Journal | journal | ||
| ) |
Definition at line 36 of file DatabaseRotating.h.
|
pure virtual |
Implemented in ripple::NodeStore::DatabaseRotatingImp.
|
pure virtual |
Rotates the backends.
| f | A function executed before the rotation and under the same lock |
Implemented in ripple::NodeStore::DatabaseRotatingImp.
|
pure virtualinherited |
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.
Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.
|
pure virtualinherited |
Import objects from another database.
Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.
|
pure virtualinherited |
Retrieve the estimated number of pending write operations.
This is used for diagnostics.
Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.
|
pure virtualinherited |
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. |
| seq | The sequence of the ledger the object belongs to. |
true if the object was stored? Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.
|
pure virtualinherited |
Fetch an 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. |
| seq | The sequence of the ledger where the object is stored. |
Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.
|
pure 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.
| hash | The key of the object to retrieve |
| seq | The sequence of the ledger where the object is stored. |
| object | The object retrieved |
Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.
|
protectedinherited |
Definition at line 110 of file Database.cpp.
|
pure virtualinherited |
Copies a ledger stored in a different database to this one.
| ledger | The ledger to copy. |
Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.
|
protectedinherited |
Definition at line 230 of file Database.cpp.
|
inherited |
Wait for all currently pending async reads to complete.
Definition at line 61 of file Database.cpp.
|
pure virtualinherited |
Get the maximum number of async reads the node store prefers.
| seq | A ledger sequence specifying a shard to query. |
Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.
|
pure virtualinherited |
Get the positive cache hits to total attempts ratio.
Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.
|
pure virtualinherited |
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 |
Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.
|
pure virtualinherited |
Remove expired entries from the positive and negative caches.
Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.
|
inherited |
Gather statistics pertaining to read and write activities.
Definition at line 191 of file Database.h.
|
inherited |
Definition at line 197 of file Database.h.
|
inherited |
Definition at line 203 of file Database.h.
|
inherited |
Definition at line 209 of file Database.h.
|
inherited |
Definition at line 215 of file Database.h.
|
inherited |
Returns the number of file descriptors the database expects to need.
Definition at line 222 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.
Definition at line 87 of file Database.cpp.
|
inherited |
Definition at line 236 of file Database.h.
|
protectedinherited |
Definition at line 93 of file Database.cpp.
|
protectedinherited |
Definition at line 250 of file Database.h.
|
protectedinherited |
Definition at line 123 of file Database.cpp.
|
protectedinherited |
Definition at line 158 of file Database.cpp.
|
protectedinherited |
Definition at line 184 of file Database.cpp.
|
privatepure virtualinherited |
|
privatepure virtualinherited |
Visit every object in the database This is usually called during import.
Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.
|
privateinherited |
Definition at line 340 of file Database.cpp.
|
inherited |
Definition at line 213 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 436 of file Stoppable.h.
|
inherited |
Sleep or wake up on stop.
true if we are stopping Definition at line 454 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::test::Stoppable_test::Root, ripple::OverlayImpl, 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::test::Stoppable_test::Root, ripple::OverlayImpl, 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 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.
|
protectedinherited |
Definition at line 242 of file Database.h.
|
protectedinherited |
Definition at line 243 of file Database.h.
|
protectedinherited |
Definition at line 244 of file Database.h.
|
privateinherited |
Definition at line 290 of file Database.h.
|
privateinherited |
Definition at line 291 of file Database.h.
|
privateinherited |
Definition at line 292 of file Database.h.
|
privateinherited |
Definition at line 293 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 298 of file Database.h.
|
privateinherited |
Definition at line 307 of file Database.h.
|
privateinherited |
Definition at line 310 of file Database.h.
|
privateinherited |
Definition at line 312 of file Database.h.
|
privateinherited |
Definition at line 313 of file Database.h.
|
privateinherited |
Definition at line 316 of file Database.h.
|
privateinherited |
Definition at line 320 of file Database.h.
|
privateinherited |
Definition at line 338 of file Stoppable.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.
1.8.17