xrpld
Loading...
Searching...
No Matches
xrpl::tests::TestNodeFamily Class Reference

#include <common.h>

Inheritance diagram for xrpl::tests::TestNodeFamily:
Collaboration diagram for xrpl::tests::TestNodeFamily:

Public Member Functions

 TestNodeFamily (beast::Journal j, int readThreads=1)
node_store::Database & db () override
node_store::Database const & db () const override
beast::Journal const & journal () override
std::shared_ptr< FullBelowCache > getFullBelowCache () override
 Return a pointer to the Family Full Below Cache.
std::shared_ptr< TreeNodeCache > getTreeNodeCache () override
 Return a pointer to the Family Tree Node Cache.
void sweep () override
void missingNodeAcquireBySeq (std::uint32_t refNum, UInt256 const &nodeHash) override
 Record the report and throw, standing in for Family's real acquisition machinery.
void missingNodeAcquireByHash (UInt256 const &refHash, std::uint32_t refNum) override
 Throw, standing in for Family's real acquisition machinery.
std::size_t missingBySeqReports () const
 How many times a map of this family has withdrawn its claim of being complete in the database.
std::uint32_t missingBySeqRefNum () const
 The ledger sequence the most recent such report named.
void reset () override
TestStopwatch & clock ()

Private Attributes

std::unique_ptr< node_store::Database > db_
TestStopwatch clock_
std::shared_ptr< FullBelowCache > fbCache_
std::shared_ptr< TreeNodeCache > tnCache_
node_store::DummyScheduler scheduler_
beast::Journal const j_
std::atomic< std::size_t > missingBySeqReports_ = 0
std::atomic< std::uint32_t > missingBySeqRefNum_ = 0

Detailed Description

Definition at line 26 of file common.h.

Constructor & Destructor Documentation

◆ TestNodeFamily()

xrpl::tests::TestNodeFamily::TestNodeFamily ( beast::Journal j,
int readThreads = 1 )
explicit
Parameters
jThe journal to log through.
readThreadsHow many nodestore reader threads to run asynchronous fetches on.

Definition at line 51 of file common.h.

Member Function Documentation

◆ db() [1/2]

node_store::Database & xrpl::tests::TestNodeFamily::db ( )
overridevirtual

Implements xrpl::Family.

Definition at line 70 of file common.h.

◆ db() [2/2]

node_store::Database const & xrpl::tests::TestNodeFamily::db ( ) const
nodiscardoverridevirtual

Implements xrpl::Family.

Definition at line 76 of file common.h.

◆ journal()

beast::Journal const & xrpl::tests::TestNodeFamily::journal ( )
overridevirtual

Implements xrpl::Family.

Definition at line 82 of file common.h.

◆ getFullBelowCache()

std::shared_ptr< FullBelowCache > xrpl::tests::TestNodeFamily::getFullBelowCache ( )
overridevirtual

Return a pointer to the Family Full Below Cache.

Implements xrpl::Family.

Definition at line 88 of file common.h.

◆ getTreeNodeCache()

std::shared_ptr< TreeNodeCache > xrpl::tests::TestNodeFamily::getTreeNodeCache ( )
overridevirtual

Return a pointer to the Family Tree Node Cache.

Implements xrpl::Family.

Definition at line 94 of file common.h.

◆ sweep()

void xrpl::tests::TestNodeFamily::sweep ( )
overridevirtual

Implements xrpl::Family.

Definition at line 100 of file common.h.

◆ missingNodeAcquireBySeq()

void xrpl::tests::TestNodeFamily::missingNodeAcquireBySeq ( std::uint32_t refNum,
UInt256 const & nodeHash )
overridevirtual

Record the report and throw, standing in for Family's real acquisition machinery.

Parameters
refNumSequence of the ledger with the missing node. Recorded, and readable through missingBySeqRefNum().
nodeHashHash of the missing node. Unused.

Implements xrpl::Family.

Definition at line 115 of file common.h.

◆ missingNodeAcquireByHash()

void xrpl::tests::TestNodeFamily::missingNodeAcquireByHash ( UInt256 const & refHash,
std::uint32_t refNum )
overridevirtual

Throw, standing in for Family's real acquisition machinery.

Uncounted.

Parameters
refHashHash of the ledger with the missing node. Unused.
refNumSequence of the ledger with the missing node. Unused.

Implements xrpl::Family.

Definition at line 129 of file common.h.

◆ missingBySeqReports()

std::size_t xrpl::tests::TestNodeFamily::missingBySeqReports ( ) const
nodiscard

How many times a map of this family has withdrawn its claim of being complete in the database.

Counted per family, not per map.

Returns
The number of missingNodeAcquireBySeq() calls so far.

Definition at line 143 of file common.h.

◆ missingBySeqRefNum()

std::uint32_t xrpl::tests::TestNodeFamily::missingBySeqRefNum ( ) const
nodiscard

The ledger sequence the most recent such report named.

Returns
The sequence, or zero if nothing has been reported yet.

Definition at line 154 of file common.h.

◆ reset()

void xrpl::tests::TestNodeFamily::reset ( )
overridevirtual

Implements xrpl::Family.

Definition at line 160 of file common.h.

◆ clock()

TestStopwatch & xrpl::tests::TestNodeFamily::clock ( )

Definition at line 167 of file common.h.

Member Data Documentation

◆ db_

std::unique_ptr<node_store::Database> xrpl::tests::TestNodeFamily::db_
private

Definition at line 29 of file common.h.

◆ clock_

TestStopwatch xrpl::tests::TestNodeFamily::clock_
private

Definition at line 32 of file common.h.

◆ fbCache_

std::shared_ptr<FullBelowCache> xrpl::tests::TestNodeFamily::fbCache_
private

Definition at line 34 of file common.h.

◆ tnCache_

std::shared_ptr<TreeNodeCache> xrpl::tests::TestNodeFamily::tnCache_
private

Definition at line 35 of file common.h.

◆ scheduler_

node_store::DummyScheduler xrpl::tests::TestNodeFamily::scheduler_
private

Definition at line 37 of file common.h.

◆ j_

beast::Journal const xrpl::tests::TestNodeFamily::j_
private

Definition at line 39 of file common.h.

◆ missingBySeqReports_

std::atomic<std::size_t> xrpl::tests::TestNodeFamily::missingBySeqReports_ = 0
private

Definition at line 42 of file common.h.

◆ missingBySeqRefNum_

std::atomic<std::uint32_t> xrpl::tests::TestNodeFamily::missingBySeqRefNum_ = 0
private

Definition at line 43 of file common.h.