rippled
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ripple::ShardFamily Class Reference
Inheritance diagram for ripple::ShardFamily:
Inheritance graph
[legend]
Collaboration diagram for ripple::ShardFamily:
Collaboration graph
[legend]

Public Member Functions

 ShardFamily ()=delete
 
 ShardFamily (ShardFamily const &)=delete
 
 ShardFamily (ShardFamily &&)=delete
 
ShardFamilyoperator= (ShardFamily const &)=delete
 
ShardFamilyoperator= (ShardFamily &&)=delete
 
 ShardFamily (Application &app, CollectorManager &cm)
 
NodeStore::Databasedb () override
 
NodeStore::Database const & db () const override
 
beast::Journal const & journal () override
 
bool isShardBacked () const override
 
std::shared_ptr< FullBelowCachegetFullBelowCache (std::uint32_t ledgerSeq) override
 Return a pointer to the Family Full Below Cache. More...
 
int getFullBelowCacheSize ()
 Return the number of entries in the cache. More...
 
std::shared_ptr< TreeNodeCachegetTreeNodeCache (std::uint32_t ledgerSeq) override
 Return a pointer to the Family Tree Node Cache. More...
 
std::pair< int, int > getTreeNodeCacheSize ()
 Return a pair where the first item is the number of items cached and the second item is the number of entries in the cached. More...
 
void sweep () override
 
void reset () override
 
void missingNodeAcquireBySeq (std::uint32_t seq, uint256 const &nodeHash) override
 Acquire ledger that has a missing node by ledger sequence. More...
 
void missingNodeAcquireByHash (uint256 const &hash, std::uint32_t seq) override
 Acquire ledger that has a missing node by ledger hash. More...
 

Private Member Functions

void acquire (uint256 const &hash, std::uint32_t seq)
 

Private Attributes

Applicationapp_
 
NodeStore::Databasedb_
 
CollectorManagercm_
 
const beast::Journal j_
 
std::unordered_map< std::uint32_t, std::shared_ptr< FullBelowCache > > fbCache_
 
std::mutex fbCacheMutex_
 
std::unordered_map< std::uint32_t, std::shared_ptr< TreeNodeCache > > tnCache_
 
std::mutex tnCacheMutex_
 
const int tnTargetSize_
 
const std::chrono::seconds tnTargetAge_
 
LedgerIndex maxSeq_ {0}
 
std::mutex maxSeqMutex_
 

Detailed Description

Definition at line 30 of file ShardFamily.h.

Constructor & Destructor Documentation

◆ ShardFamily() [1/4]

ripple::ShardFamily::ShardFamily ( )
delete

◆ ShardFamily() [2/4]

ripple::ShardFamily::ShardFamily ( ShardFamily const &  )
delete

◆ ShardFamily() [3/4]

ripple::ShardFamily::ShardFamily ( ShardFamily &&  )
delete

◆ ShardFamily() [4/4]

ripple::ShardFamily::ShardFamily ( Application app,
CollectorManager cm 
)

Definition at line 37 of file ShardFamily.cpp.

Member Function Documentation

◆ operator=() [1/2]

ShardFamily& ripple::ShardFamily::operator= ( ShardFamily const &  )
delete

◆ operator=() [2/2]

ShardFamily& ripple::ShardFamily::operator= ( ShardFamily &&  )
delete

◆ db() [1/2]

NodeStore::Database& ripple::ShardFamily::db ( )
overridevirtual

Implements ripple::Family.

Definition at line 46 of file ShardFamily.h.

◆ db() [2/2]

NodeStore::Database const& ripple::ShardFamily::db ( ) const
overridevirtual

Implements ripple::Family.

Definition at line 52 of file ShardFamily.h.

◆ journal()

beast::Journal const& ripple::ShardFamily::journal ( )
overridevirtual

Implements ripple::Family.

Definition at line 58 of file ShardFamily.h.

◆ isShardBacked()

bool ripple::ShardFamily::isShardBacked ( ) const
overridevirtual

Implements ripple::Family.

Definition at line 64 of file ShardFamily.h.

◆ getFullBelowCache()

std::shared_ptr< FullBelowCache > ripple::ShardFamily::getFullBelowCache ( std::uint32_t  ledgerSeq)
overridevirtual

Return a pointer to the Family Full Below Cache.

Parameters
ledgerSeqledger sequence determines a corresponding shard cache
Note
ledgerSeq is used by ShardFamily and ignored by NodeFamily

Implements ripple::Family.

Definition at line 48 of file ShardFamily.cpp.

◆ getFullBelowCacheSize()

int ripple::ShardFamily::getFullBelowCacheSize ( )

Return the number of entries in the cache.

Definition at line 67 of file ShardFamily.cpp.

◆ getTreeNodeCache()

std::shared_ptr< TreeNodeCache > ripple::ShardFamily::getTreeNodeCache ( std::uint32_t  ledgerSeq)
overridevirtual

Return a pointer to the Family Tree Node Cache.

Parameters
ledgerSeqledger sequence determines a corresponding shard cache
Note
ledgerSeq is used by ShardFamily and ignored by NodeFamily

Implements ripple::Family.

Definition at line 77 of file ShardFamily.cpp.

◆ getTreeNodeCacheSize()

std::pair< int, int > ripple::ShardFamily::getTreeNodeCacheSize ( )

Return a pair where the first item is the number of items cached and the second item is the number of entries in the cached.

Definition at line 95 of file ShardFamily.cpp.

◆ sweep()

void ripple::ShardFamily::sweep ( )
overridevirtual

Implements ripple::Family.

Definition at line 109 of file ShardFamily.cpp.

◆ reset()

void ripple::ShardFamily::reset ( )
overridevirtual

Implements ripple::Family.

Definition at line 139 of file ShardFamily.cpp.

◆ missingNodeAcquireBySeq()

void ripple::ShardFamily::missingNodeAcquireBySeq ( std::uint32_t  refNum,
uint256 const &  nodeHash 
)
overridevirtual

Acquire ledger that has a missing node by ledger sequence.

Throw if in reporting mode.

Parameters
refNumSequence of ledger to acquire.
nodeHashHash of missing node to report in throw.

Implements ripple::Family.

Definition at line 156 of file ShardFamily.cpp.

◆ missingNodeAcquireByHash()

void ripple::ShardFamily::missingNodeAcquireByHash ( uint256 const &  refHash,
std::uint32_t  refNum 
)
overridevirtual

Acquire ledger that has a missing node by ledger hash.

Parameters
refHashHash of ledger to acquire.
refNumLedger sequence with missing node.

Implements ripple::Family.

Definition at line 96 of file ShardFamily.h.

◆ acquire()

void ripple::ShardFamily::acquire ( uint256 const &  hash,
std::uint32_t  seq 
)
private

Definition at line 187 of file ShardFamily.cpp.

Member Data Documentation

◆ app_

Application& ripple::ShardFamily::app_
private

Definition at line 102 of file ShardFamily.h.

◆ db_

NodeStore::Database& ripple::ShardFamily::db_
private

Definition at line 103 of file ShardFamily.h.

◆ cm_

CollectorManager& ripple::ShardFamily::cm_
private

Definition at line 104 of file ShardFamily.h.

◆ j_

const beast::Journal ripple::ShardFamily::j_
private

Definition at line 105 of file ShardFamily.h.

◆ fbCache_

std::unordered_map<std::uint32_t, std::shared_ptr<FullBelowCache> > ripple::ShardFamily::fbCache_
private

Definition at line 107 of file ShardFamily.h.

◆ fbCacheMutex_

std::mutex ripple::ShardFamily::fbCacheMutex_
private

Definition at line 108 of file ShardFamily.h.

◆ tnCache_

std::unordered_map<std::uint32_t, std::shared_ptr<TreeNodeCache> > ripple::ShardFamily::tnCache_
private

Definition at line 110 of file ShardFamily.h.

◆ tnCacheMutex_

std::mutex ripple::ShardFamily::tnCacheMutex_
private

Definition at line 111 of file ShardFamily.h.

◆ tnTargetSize_

const int ripple::ShardFamily::tnTargetSize_
private

Definition at line 112 of file ShardFamily.h.

◆ tnTargetAge_

const std::chrono::seconds ripple::ShardFamily::tnTargetAge_
private

Definition at line 113 of file ShardFamily.h.

◆ maxSeq_

LedgerIndex ripple::ShardFamily::maxSeq_ {0}
private

Definition at line 116 of file ShardFamily.h.

◆ maxSeqMutex_

std::mutex ripple::ShardFamily::maxSeqMutex_
private

Definition at line 117 of file ShardFamily.h.