CatapultServer  v0.5.0.1 (Elephant)
catapult::tree::ReadThroughMemoryDataSource< TBackingDataSource > Class Template Reference

A patricia tree memory data source that reads through but does not write through. More...

Collaboration diagram for catapult::tree::ReadThroughMemoryDataSource< TBackingDataSource >:

Public Member Functions

 ReadThroughMemoryDataSource (const TBackingDataSource &backingDataSource, DataSourceVerbosity verbosity=DataSourceVerbosity::Off)
 Creates a data source around backingDataSource with specified verbosity. More...
 
size_t size () const
 Gets the number of saved nodes in the in memory cache. More...
 
std::unique_ptr< const TreeNodeget (const Hash256 &hash) const
 Gets the tree node associated with hash. More...
 
void forEach (const consumer< const TreeNode & > &consumer) const
 Gets all nodes in memory and passes them to consumer. More...
 
void set (const LeafTreeNode &node)
 Saves a leaf tree node. More...
 
void set (const BranchTreeNode &node)
 Saves a branch tree node. More...
 
void clear ()
 Clears all cached memory nodes. More...
 

Private Attributes

const TBackingDataSource & m_backingDataSource
 
MemoryDataSource m_memoryDataSource
 

Detailed Description

template<typename TBackingDataSource>
class catapult::tree::ReadThroughMemoryDataSource< TBackingDataSource >

A patricia tree memory data source that reads through but does not write through.

Constructor & Destructor Documentation

◆ ReadThroughMemoryDataSource()

template<typename TBackingDataSource>
catapult::tree::ReadThroughMemoryDataSource< TBackingDataSource >::ReadThroughMemoryDataSource ( const TBackingDataSource &  backingDataSource,
DataSourceVerbosity  verbosity = DataSourceVerbosity::Off 
)
inlineexplicit

Creates a data source around backingDataSource with specified verbosity.

Member Function Documentation

◆ clear()

template<typename TBackingDataSource>
void catapult::tree::ReadThroughMemoryDataSource< TBackingDataSource >::clear ( )
inline

Clears all cached memory nodes.

◆ forEach()

template<typename TBackingDataSource>
void catapult::tree::ReadThroughMemoryDataSource< TBackingDataSource >::forEach ( const consumer< const TreeNode & > &  consumer) const
inline

Gets all nodes in memory and passes them to consumer.

Here is the caller graph for this function:

◆ get()

template<typename TBackingDataSource>
std::unique_ptr<const TreeNode> catapult::tree::ReadThroughMemoryDataSource< TBackingDataSource >::get ( const Hash256 hash) const
inline

Gets the tree node associated with hash.

Here is the caller graph for this function:

◆ set() [1/2]

template<typename TBackingDataSource>
void catapult::tree::ReadThroughMemoryDataSource< TBackingDataSource >::set ( const BranchTreeNode node)
inline

Saves a branch tree node.

◆ set() [2/2]

template<typename TBackingDataSource>
void catapult::tree::ReadThroughMemoryDataSource< TBackingDataSource >::set ( const LeafTreeNode node)
inline

Saves a leaf tree node.

◆ size()

template<typename TBackingDataSource>
size_t catapult::tree::ReadThroughMemoryDataSource< TBackingDataSource >::size ( ) const
inline

Gets the number of saved nodes in the in memory cache.

Member Data Documentation

◆ m_backingDataSource

template<typename TBackingDataSource>
const TBackingDataSource& catapult::tree::ReadThroughMemoryDataSource< TBackingDataSource >::m_backingDataSource
private

◆ m_memoryDataSource

template<typename TBackingDataSource>
MemoryDataSource catapult::tree::ReadThroughMemoryDataSource< TBackingDataSource >::m_memoryDataSource
private

The documentation for this class was generated from the following file: