rippled
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
ripple::NodeStore::DatabaseShard Class Referenceabstract

A collection of historical shards. More...

Inheritance diagram for ripple::NodeStore::DatabaseShard:
Inheritance graph
[legend]
Collaboration diagram for ripple::NodeStore::DatabaseShard:
Collaboration graph
[legend]

Public Member Functions

 DatabaseShard (std::string const &name, Stoppable &parent, Scheduler &scheduler, int readThreads, Section const &config, beast::Journal journal)
 Construct a shard store. More...
 
virtual bool init ()=0
 Initialize the database. More...
 
virtual boost::optional< std::uint32_tprepareLedger (std::uint32_t validLedgerSeq)=0
 Prepare to store a new ledger in the shard being acquired. More...
 
virtual bool prepareShards (std::vector< std::uint32_t > const &shardIndexes)=0
 Prepare one or more shard indexes to be imported into the database. More...
 
virtual void removePreShard (std::uint32_t shardIndex)=0
 Remove a previously prepared shard index for import. More...
 
virtual std::string getPreShards ()=0
 Get shard indexes being imported. More...
 
virtual bool importShard (std::uint32_t shardIndex, boost::filesystem::path const &srcDir)=0
 Import a shard into the shard database. More...
 
virtual std::shared_ptr< LedgerfetchLedger (uint256 const &hash, std::uint32_t seq)=0
 Fetch a ledger from the shard store. More...
 
virtual void setStored (std::shared_ptr< Ledger const > const &ledger)=0
 Notifies the database that the given ledger has been fully acquired and stored. More...
 
virtual std::string getCompleteShards ()=0
 Query which complete shards are stored. More...
 
virtual std::uint32_t ledgersPerShard () const =0
 
virtual std::uint32_t earliestShardIndex () const =0
 
virtual std::uint32_t seqToShardIndex (std::uint32_t seq) const =0
 Calculates the shard index for a given ledger sequence. More...
 
virtual std::uint32_t firstLedgerSeq (std::uint32_t shardIndex) const =0
 Calculates the first ledger sequence for a given shard index. More...
 
virtual std::uint32_t lastLedgerSeq (std::uint32_t shardIndex) const =0
 Calculates the last ledger sequence for a given shard index. More...
 
virtual boost::filesystem::path const & getRootDir () const =0
 Returns the root database directory. 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 ledgerSeq)=0
 Store the object. More...
 
std::shared_ptr< NodeObjectfetchNodeObject (uint256 const &hash, std::uint32_t ledgerSeq=0, FetchType fetchType=FetchType::synchronous)
 Fetch a node object. More...
 
virtual bool asyncFetch (uint256 const &hash, std::uint32_t ledgerSeq, std::shared_ptr< NodeObject > &nodeObject)=0
 Fetch an object without waiting. More...
 
virtual bool storeLedger (std::shared_ptr< Ledger const > const &srcLedger)=0
 Store a ledger from a different database. More...
 
void waitReads ()
 Wait for all currently pending async reads to complete. More...
 
virtual int getDesiredAsyncReadCount (std::uint32_t ledgerSeq)=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::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
 
RootStoppablegetRoot ()
 
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...
 
JobCounterjobCounter ()
 
bool alertable_sleep_until (std::chrono::system_clock::time_point const &t)
 Sleep or wake up on stop. More...
 

Static Public Attributes

static constexpr std::uint32_t ledgersPerShardDefault {16384u}
 The number of ledgers in a shard. 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_
 
Schedulerscheduler_
 
int fdRequired_ {0}
 
std::atomic< std::uint32_tfetchHitCount_ {0}
 
std::atomic< std::uint32_tfetchSz_ {0}
 

Private Types

using Children = beast::LockFreeStack< Child >
 

Private Member Functions

virtual std::shared_ptr< NodeObjectfetchNodeObject (uint256 const &hash, std::uint32_t ledgerSeq, FetchReport &fetchReport)=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::uint64_tstoreCount_ {0}
 
std::atomic< std::uint64_tstoreSz_ {0}
 
std::atomic< std::uint64_tfetchTotalCount_ {0}
 
std::mutex readLock_
 
std::condition_variable readCondVar_
 
std::condition_variable readGenCondVar_
 
std::map< uint256, std::uint32_tread_
 
uint256 readLastHash_
 
std::vector< std::threadreadThreads_
 
bool readShut_ {false}
 
uint64_t readGen_ {0}
 
const std::uint32_t earliestLedgerSeq_
 
std::string m_name
 
RootStoppablem_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}
 

Detailed Description

A collection of historical shards.

Definition at line 37 of file DatabaseShard.h.

Member Typedef Documentation

◆ Children

Definition at line 319 of file Stoppable.h.

Constructor & Destructor Documentation

◆ DatabaseShard()

ripple::NodeStore::DatabaseShard::DatabaseShard ( std::string const &  name,
Stoppable parent,
Scheduler scheduler,
int  readThreads,
Section const &  config,
beast::Journal  journal 
)

Construct a shard store.

Parameters
nameThe Stoppable name for this Database
parentThe parent Stoppable
schedulerThe scheduler to use for performing asynchronous tasks
readThreadsThe number of asynchronous read threads to create
configThe shard configuration section for the database
journalDestination for logging output

Definition at line 49 of file DatabaseShard.h.

Member Function Documentation

◆ init()

virtual bool ripple::NodeStore::DatabaseShard::init ( )
pure virtual

Initialize the database.

Returns
true if the database initialized without error

Implemented in ripple::NodeStore::DatabaseShardImp.

◆ prepareLedger()

virtual boost::optional<std::uint32_t> ripple::NodeStore::DatabaseShard::prepareLedger ( std::uint32_t  validLedgerSeq)
pure virtual

Prepare to store a new ledger in the shard being acquired.

Parameters
validLedgerSeqThe sequence of the maximum valid ledgers
Returns
If a ledger should be fetched and stored, then returns the ledger sequence of the ledger to request. Otherwise returns boost::none. Some reasons this may return boost::none are: all shards are stored and full, max allowed disk space would be exceeded, or a ledger was recently requested and not enough time has passed between requests. @implNote adds a new writable shard if necessary

Implemented in ripple::NodeStore::DatabaseShardImp.

◆ prepareShards()

virtual bool ripple::NodeStore::DatabaseShard::prepareShards ( std::vector< std::uint32_t > const &  shardIndexes)
pure virtual

Prepare one or more shard indexes to be imported into the database.

Parameters
shardIndexesShard indexes to be prepared for import
Returns
true if all shard indexes successfully prepared for import

Implemented in ripple::NodeStore::DatabaseShardImp.

◆ removePreShard()

virtual void ripple::NodeStore::DatabaseShard::removePreShard ( std::uint32_t  shardIndex)
pure virtual

Remove a previously prepared shard index for import.

Parameters
shardIndexShard index to be removed from import

Implemented in ripple::NodeStore::DatabaseShardImp.

◆ getPreShards()

virtual std::string ripple::NodeStore::DatabaseShard::getPreShards ( )
pure virtual

Get shard indexes being imported.

Returns
a string representing the shards prepared for import

Implemented in ripple::NodeStore::DatabaseShardImp.

◆ importShard()

virtual bool ripple::NodeStore::DatabaseShard::importShard ( std::uint32_t  shardIndex,
boost::filesystem::path const &  srcDir 
)
pure virtual

Import a shard into the shard database.

Parameters
shardIndexShard index to import
srcDirThe directory to import from
Returns
true If the shard was successfully imported @implNote if successful, srcDir is moved to the database directory

Implemented in ripple::NodeStore::DatabaseShardImp.

◆ fetchLedger()

virtual std::shared_ptr<Ledger> ripple::NodeStore::DatabaseShard::fetchLedger ( uint256 const &  hash,
std::uint32_t  seq 
)
pure virtual

Fetch a ledger from the shard store.

Parameters
hashThe key of the ledger to retrieve
seqThe sequence of the ledger
Returns
The ledger if found, nullptr otherwise

Implemented in ripple::NodeStore::DatabaseShardImp.

◆ setStored()

virtual void ripple::NodeStore::DatabaseShard::setStored ( std::shared_ptr< Ledger const > const &  ledger)
pure virtual

Notifies the database that the given ledger has been fully acquired and stored.

Parameters
ledgerThe stored ledger to be marked as complete

Implemented in ripple::NodeStore::DatabaseShardImp.

◆ getCompleteShards()

virtual std::string ripple::NodeStore::DatabaseShard::getCompleteShards ( )
pure virtual

Query which complete shards are stored.

Returns
the indexes of complete shards

Implemented in ripple::NodeStore::DatabaseShardImp.

◆ ledgersPerShard()

virtual std::uint32_t ripple::NodeStore::DatabaseShard::ledgersPerShard ( ) const
pure virtual
Returns
The maximum number of ledgers stored in a shard

Implemented in ripple::NodeStore::DatabaseShardImp.

◆ earliestShardIndex()

virtual std::uint32_t ripple::NodeStore::DatabaseShard::earliestShardIndex ( ) const
pure virtual
Returns
The earliest shard index

Implemented in ripple::NodeStore::DatabaseShardImp.

◆ seqToShardIndex()

virtual std::uint32_t ripple::NodeStore::DatabaseShard::seqToShardIndex ( std::uint32_t  seq) const
pure virtual

Calculates the shard index for a given ledger sequence.

Parameters
seqledger sequence
Returns
The shard index of the ledger sequence

Implemented in ripple::NodeStore::DatabaseShardImp.

◆ firstLedgerSeq()

virtual std::uint32_t ripple::NodeStore::DatabaseShard::firstLedgerSeq ( std::uint32_t  shardIndex) const
pure virtual

Calculates the first ledger sequence for a given shard index.

Parameters
shardIndexThe shard index considered
Returns
The first ledger sequence pertaining to the shard index

Implemented in ripple::NodeStore::DatabaseShardImp.

◆ lastLedgerSeq()

virtual std::uint32_t ripple::NodeStore::DatabaseShard::lastLedgerSeq ( std::uint32_t  shardIndex) const
pure virtual

Calculates the last ledger sequence for a given shard index.

Parameters
shardIndexThe shard index considered
Returns
The last ledger sequence pertaining to the shard index

Implemented in ripple::NodeStore::DatabaseShardImp.

◆ getRootDir()

virtual boost::filesystem::path const& ripple::NodeStore::DatabaseShard::getRootDir ( ) const
pure virtual

Returns the root database directory.

Implemented in ripple::NodeStore::DatabaseShardImp.

◆ getName()

virtual std::string ripple::NodeStore::Database::getName ( ) const
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.

◆ import()

virtual void ripple::NodeStore::Database::import ( Database source)
pure virtualinherited

◆ getWriteLoad()

virtual std::int32_t ripple::NodeStore::Database::getWriteLoad ( ) const
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.

◆ store()

virtual void ripple::NodeStore::Database::store ( NodeObjectType  type,
Blob &&  data,
uint256 const &  hash,
std::uint32_t  ledgerSeq 
)
pure virtualinherited

Store the object.

The caller's Blob parameter is overwritten.

Parameters
typeThe type of object.
dataThe payload of the object. The caller's variable is overwritten.
hashThe 256-bit hash of the payload data.
ledgerSeqThe sequence of the ledger the object belongs to.
Returns
true if the object was stored?

Implemented in ripple::NodeStore::DatabaseNodeImp, ripple::NodeStore::DatabaseRotatingImp, and ripple::NodeStore::DatabaseShardImp.

◆ fetchNodeObject() [1/2]

std::shared_ptr< NodeObject > ripple::NodeStore::Database::fetchNodeObject ( uint256 const &  hash,
std::uint32_t  ledgerSeq = 0,
FetchType  fetchType = FetchType::synchronous 
)
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.

Note
This can be called concurrently.
Parameters
hashThe key of the object to retrieve.
ledgerSeqThe sequence of the ledger where the object is stored.
fetchTypethe type of fetch, synchronous or asynchronous.
Returns
The object, or nullptr if it couldn't be retrieved.

Definition at line 158 of file Database.cpp.

◆ fetchNodeObject() [2/2]

virtual std::shared_ptr<NodeObject> ripple::NodeStore::Database::fetchNodeObject ( uint256 const &  hash,
std::uint32_t  ledgerSeq,
FetchReport fetchReport 
)
privatepure virtualinherited

◆ asyncFetch() [1/2]

virtual bool ripple::NodeStore::Database::asyncFetch ( uint256 const &  hash,
std::uint32_t  ledgerSeq,
std::shared_ptr< NodeObject > &  nodeObject 
)
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.

Note
This can be called concurrently.
Parameters
hashThe key of the object to retrieve
ledgerSeqThe sequence of the ledger where the object is stored, used by the shard store.
nodeObjectThe object retrieved
Returns
Whether the operation completed

Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.

◆ asyncFetch() [2/2]

void ripple::NodeStore::Database::asyncFetch ( uint256 const &  hash,
std::uint32_t  ledgerSeq 
)
protectedinherited

Definition at line 110 of file Database.cpp.

◆ storeLedger() [1/2]

virtual bool ripple::NodeStore::Database::storeLedger ( std::shared_ptr< Ledger const > const &  srcLedger)
pure virtualinherited

Store a ledger from a different database.

Parameters
srcLedgerThe ledger to store.
Returns
true if the operation was successful

Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.

◆ storeLedger() [2/2]

bool ripple::NodeStore::Database::storeLedger ( Ledger const &  srcLedger,
std::shared_ptr< Backend dstBackend,
std::shared_ptr< TaggedCache< uint256, NodeObject >>  dstPCache,
std::shared_ptr< KeyCache< uint256 >>  dstNCache 
)
protectedinherited

Definition at line 184 of file Database.cpp.

◆ waitReads()

void ripple::NodeStore::Database::waitReads ( )
inherited

Wait for all currently pending async reads to complete.

Definition at line 61 of file Database.cpp.

◆ getDesiredAsyncReadCount()

virtual int ripple::NodeStore::Database::getDesiredAsyncReadCount ( std::uint32_t  ledgerSeq)
pure virtualinherited

Get the maximum number of async reads the node store prefers.

Parameters
ledgerSeqA ledger sequence specifying a shard to query.
Returns
The number of async reads preferred.
Note
The sequence is only used with the shard store.

Implemented in ripple::NodeStore::DatabaseNodeImp, ripple::NodeStore::DatabaseRotatingImp, and ripple::NodeStore::DatabaseShardImp.

◆ getCacheHitRate()

virtual float ripple::NodeStore::Database::getCacheHitRate ( )
pure virtualinherited

Get the positive cache hits to total attempts ratio.

Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.

◆ tune()

virtual void ripple::NodeStore::Database::tune ( int  size,
std::chrono::seconds  age 
)
pure virtualinherited

Set the maximum number of entries and maximum cache age for both caches.

Parameters
sizeNumber of cache entries (0 = ignore)
ageMaximum cache age in seconds

Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.

◆ sweep()

virtual void ripple::NodeStore::Database::sweep ( )
pure virtualinherited

Remove expired entries from the positive and negative caches.

Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.

◆ getStoreCount()

std::uint64_t ripple::NodeStore::Database::getStoreCount ( ) const
inherited

Gather statistics pertaining to read and write activities.

Returns
The total read and written bytes.

Definition at line 196 of file Database.h.

◆ getFetchTotalCount()

std::uint32_t ripple::NodeStore::Database::getFetchTotalCount ( ) const
inherited

Definition at line 202 of file Database.h.

◆ getFetchHitCount()

std::uint32_t ripple::NodeStore::Database::getFetchHitCount ( ) const
inherited

Definition at line 208 of file Database.h.

◆ getStoreSize()

std::uint64_t ripple::NodeStore::Database::getStoreSize ( ) const
inherited

Definition at line 214 of file Database.h.

◆ getFetchSize()

std::uint32_t ripple::NodeStore::Database::getFetchSize ( ) const
inherited

Definition at line 220 of file Database.h.

◆ fdRequired()

int ripple::NodeStore::Database::fdRequired ( ) const
inherited

Returns the number of file descriptors the database expects to need.

Definition at line 227 of file Database.h.

◆ onStop()

void ripple::NodeStore::Database::onStop ( )
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.

◆ onChildrenStopped()

void ripple::NodeStore::Database::onChildrenStopped ( )
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.

◆ earliestLedgerSeq()

std::uint32_t ripple::NodeStore::Database::earliestLedgerSeq ( ) const
inherited
Returns
The earliest ledger sequence allowed

Definition at line 241 of file Database.h.

◆ stopReadThreads()

void ripple::NodeStore::Database::stopReadThreads ( )
protectedinherited

Definition at line 93 of file Database.cpp.

◆ storeStats()

void ripple::NodeStore::Database::storeStats ( std::uint64_t  count,
std::uint64_t  sz 
)
protectedinherited

Definition at line 258 of file Database.h.

◆ importInternal()

void ripple::NodeStore::Database::importInternal ( Backend dstBackend,
Database srcDB 
)
protectedinherited

Definition at line 119 of file Database.cpp.

◆ for_each()

virtual void ripple::NodeStore::Database::for_each ( std::function< void(std::shared_ptr< NodeObject >)>  f)
privatepure virtualinherited

Visit every object in the database This is usually called during import.

Note
This routine will not be called concurrently with itself or other methods.
See also
import

Implemented in ripple::NodeStore::DatabaseShardImp, ripple::NodeStore::DatabaseNodeImp, and ripple::NodeStore::DatabaseRotatingImp.

◆ threadEntry()

void ripple::NodeStore::Database::threadEntry ( )
privateinherited

Definition at line 293 of file Database.cpp.

◆ getRoot()

RootStoppable& ripple::Stoppable::getRoot ( )
inherited

Definition at line 214 of file Stoppable.h.

◆ setParent()

void ripple::Stoppable::setParent ( Stoppable parent)
inherited

Set the parent of this Stoppable.

Note
The Stoppable must not already have a parent. The parent to be set cannot not be stopping. Both roots must match.

Definition at line 43 of file Stoppable.cpp.

◆ isStopping()

bool ripple::Stoppable::isStopping ( ) const
inherited

Returns true if the stoppable should stop.

Definition at line 54 of file Stoppable.cpp.

◆ isStopped()

bool ripple::Stoppable::isStopped ( ) const
inherited

Returns true if the requested stop has completed.

Definition at line 60 of file Stoppable.cpp.

◆ areChildrenStopped()

bool ripple::Stoppable::areChildrenStopped ( ) const
inherited

Returns true if all children have stopped.

Definition at line 66 of file Stoppable.cpp.

◆ jobCounter()

JobCounter & ripple::Stoppable::jobCounter ( )
inherited

Definition at line 437 of file Stoppable.h.

◆ alertable_sleep_until()

bool ripple::Stoppable::alertable_sleep_until ( std::chrono::system_clock::time_point const &  t)
inherited

Sleep or wake up on stop.

Returns
true if we are stopping

Definition at line 455 of file Stoppable.h.

◆ stopped()

void ripple::Stoppable::stopped ( )
protectedinherited

Called by derived classes to indicate that the stoppable has stopped.

Definition at line 72 of file Stoppable.cpp.

◆ onPrepare()

void ripple::Stoppable::onPrepare ( )
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.

◆ onStart()

void ripple::Stoppable::onStart ( )
privatevirtualinherited

◆ prepareRecursive()

void ripple::Stoppable::prepareRecursive ( )
privateinherited

Definition at line 103 of file Stoppable.cpp.

◆ startRecursive()

void ripple::Stoppable::startRecursive ( )
privateinherited

Definition at line 113 of file Stoppable.cpp.

◆ stopAsyncRecursive()

void ripple::Stoppable::stopAsyncRecursive ( beast::Journal  j)
privateinherited

Definition at line 123 of file Stoppable.cpp.

◆ stopRecursive()

void ripple::Stoppable::stopRecursive ( beast::Journal  j)
privateinherited

Definition at line 134 of file Stoppable.cpp.

Member Data Documentation

◆ ledgersPerShardDefault

constexpr std::uint32_t ripple::NodeStore::DatabaseShard::ledgersPerShardDefault {16384u}
staticconstexpr

The number of ledgers in a shard.

Definition at line 179 of file DatabaseShard.h.

◆ j_

const beast::Journal ripple::NodeStore::Database::j_
protectedinherited

Definition at line 247 of file Database.h.

◆ scheduler_

Scheduler& ripple::NodeStore::Database::scheduler_
protectedinherited

Definition at line 248 of file Database.h.

◆ fdRequired_

int ripple::NodeStore::Database::fdRequired_ {0}
protectedinherited

Definition at line 249 of file Database.h.

◆ fetchHitCount_

std::atomic<std::uint32_t> ripple::NodeStore::Database::fetchHitCount_ {0}
protectedinherited

Definition at line 251 of file Database.h.

◆ fetchSz_

std::atomic<std::uint32_t> ripple::NodeStore::Database::fetchSz_ {0}
protectedinherited

Definition at line 252 of file Database.h.

◆ storeCount_

std::atomic<std::uint64_t> ripple::NodeStore::Database::storeCount_ {0}
privateinherited

Definition at line 282 of file Database.h.

◆ storeSz_

std::atomic<std::uint64_t> ripple::NodeStore::Database::storeSz_ {0}
privateinherited

Definition at line 283 of file Database.h.

◆ fetchTotalCount_

std::atomic<std::uint64_t> ripple::NodeStore::Database::fetchTotalCount_ {0}
privateinherited

Definition at line 284 of file Database.h.

◆ readLock_

std::mutex ripple::NodeStore::Database::readLock_
privateinherited

Definition at line 286 of file Database.h.

◆ readCondVar_

std::condition_variable ripple::NodeStore::Database::readCondVar_
privateinherited

Definition at line 287 of file Database.h.

◆ readGenCondVar_

std::condition_variable ripple::NodeStore::Database::readGenCondVar_
privateinherited

Definition at line 288 of file Database.h.

◆ read_

std::map<uint256, std::uint32_t> ripple::NodeStore::Database::read_
privateinherited

Definition at line 291 of file Database.h.

◆ readLastHash_

uint256 ripple::NodeStore::Database::readLastHash_
privateinherited

Definition at line 294 of file Database.h.

◆ readThreads_

std::vector<std::thread> ripple::NodeStore::Database::readThreads_
privateinherited

Definition at line 296 of file Database.h.

◆ readShut_

bool ripple::NodeStore::Database::readShut_ {false}
privateinherited

Definition at line 297 of file Database.h.

◆ readGen_

uint64_t ripple::NodeStore::Database::readGen_ {0}
privateinherited

Definition at line 300 of file Database.h.

◆ earliestLedgerSeq_

const std::uint32_t ripple::NodeStore::Database::earliestLedgerSeq_
privateinherited

Definition at line 304 of file Database.h.

◆ m_name

std::string ripple::Stoppable::m_name
privateinherited

Definition at line 339 of file Stoppable.h.

◆ m_root

RootStoppable& ripple::Stoppable::m_root
privateinherited

Definition at line 340 of file Stoppable.h.

◆ m_child

Child ripple::Stoppable::m_child
privateinherited

Definition at line 341 of file Stoppable.h.

◆ m_stopped

std::atomic<bool> ripple::Stoppable::m_stopped {false}
privateinherited

Definition at line 342 of file Stoppable.h.

◆ m_childrenStopped

std::atomic<bool> ripple::Stoppable::m_childrenStopped {false}
privateinherited

Definition at line 343 of file Stoppable.h.

◆ m_children

Children ripple::Stoppable::m_children
privateinherited

Definition at line 344 of file Stoppable.h.

◆ m_cv

std::condition_variable ripple::Stoppable::m_cv
privateinherited

Definition at line 345 of file Stoppable.h.

◆ m_mut

std::mutex ripple::Stoppable::m_mut
privateinherited

Definition at line 346 of file Stoppable.h.

◆ m_is_stopping

bool ripple::Stoppable::m_is_stopping = false
privateinherited

Definition at line 347 of file Stoppable.h.

◆ hasParent_

bool ripple::Stoppable::hasParent_ {false}
privateinherited

Definition at line 348 of file Stoppable.h.