CatapultServer  v0.5.0.1 (Elephant)
catapult::tree::BasePatriciaTreeDelta< TEncoder, TDataSource, THasher > Class Template Reference

A delta on top of a base patricia tree that offers methods to set/unset nodes. More...

Collaboration diagram for catapult::tree::BasePatriciaTreeDelta< TEncoder, TDataSource, THasher >:

Public Member Functions

 BasePatriciaTreeDelta (const TDataSource &dataSource, const Hash256 &rootHash)
 Creates a tree around a dataSource with root rootHash. More...
 
Hash256 root () const
 Gets the root hash that uniquely identifies this tree. More...
 
Hash256 baseRoot () const
 Gets the base root hash that identifies this tree before any changes are applied. More...
 
void reset (const Hash256 &rootHash)
 Sets the root hash (rootHash). More...
 
void set (const KeyType &key, const ValueType &value)
 Sets key to value in the tree. More...
 
bool unset (const KeyType &key)
 Removes the value associated with key from the tree. More...
 
void setCheckpoint ()
 Marks all nodes reachable at this point. More...
 
template<typename TDestinationDataSource >
void copyPendingChangesTo (TDestinationDataSource &dataSource) const
 Copies all pending changes to dataSource. More...
 
template<typename TTree >
void copyRootTo (TTree &tree) const
 Sets the root of tree to the root of this delta tree. More...
 

Private Types

using KeyType = typename TEncoder::KeyType
 
using ValueType = typename TEncoder::ValueType
 

Private Attributes

ReadThroughMemoryDataSource< TDataSource > m_dataSource
 
Hash256 m_baseRootHash
 
PatriciaTree< TEncoder, ReadThroughMemoryDataSource< TDataSource > > m_tree
 

Detailed Description

template<typename TEncoder, typename TDataSource, typename THasher>
class catapult::tree::BasePatriciaTreeDelta< TEncoder, TDataSource, THasher >

A delta on top of a base patricia tree that offers methods to set/unset nodes.

Member Typedef Documentation

◆ KeyType

template<typename TEncoder , typename TDataSource , typename THasher >
using catapult::tree::BasePatriciaTreeDelta< TEncoder, TDataSource, THasher >::KeyType = typename TEncoder::KeyType
private

◆ ValueType

template<typename TEncoder , typename TDataSource , typename THasher >
using catapult::tree::BasePatriciaTreeDelta< TEncoder, TDataSource, THasher >::ValueType = typename TEncoder::ValueType
private

Constructor & Destructor Documentation

◆ BasePatriciaTreeDelta()

template<typename TEncoder , typename TDataSource , typename THasher >
catapult::tree::BasePatriciaTreeDelta< TEncoder, TDataSource, THasher >::BasePatriciaTreeDelta ( const TDataSource &  dataSource,
const Hash256 rootHash 
)
inlineexplicit

Creates a tree around a dataSource with root rootHash.

Member Function Documentation

◆ baseRoot()

template<typename TEncoder , typename TDataSource , typename THasher >
Hash256 catapult::tree::BasePatriciaTreeDelta< TEncoder, TDataSource, THasher >::baseRoot ( ) const
inline

Gets the base root hash that identifies this tree before any changes are applied.

◆ copyPendingChangesTo()

template<typename TEncoder , typename TDataSource , typename THasher >
template<typename TDestinationDataSource >
void catapult::tree::BasePatriciaTreeDelta< TEncoder, TDataSource, THasher >::copyPendingChangesTo ( TDestinationDataSource &  dataSource) const
inline

Copies all pending changes to dataSource.

Here is the call graph for this function:

◆ copyRootTo()

template<typename TEncoder , typename TDataSource , typename THasher >
template<typename TTree >
void catapult::tree::BasePatriciaTreeDelta< TEncoder, TDataSource, THasher >::copyRootTo ( TTree &  tree) const
inline

Sets the root of tree to the root of this delta tree.

Here is the call graph for this function:

◆ reset()

template<typename TEncoder , typename TDataSource , typename THasher >
void catapult::tree::BasePatriciaTreeDelta< TEncoder, TDataSource, THasher >::reset ( const Hash256 rootHash)
inline

Sets the root hash (rootHash).

◆ root()

template<typename TEncoder , typename TDataSource , typename THasher >
Hash256 catapult::tree::BasePatriciaTreeDelta< TEncoder, TDataSource, THasher >::root ( ) const
inline

Gets the root hash that uniquely identifies this tree.

Here is the caller graph for this function:

◆ set()

template<typename TEncoder , typename TDataSource , typename THasher >
void catapult::tree::BasePatriciaTreeDelta< TEncoder, TDataSource, THasher >::set ( const KeyType key,
const ValueType value 
)
inline

Sets key to value in the tree.

◆ setCheckpoint()

template<typename TEncoder , typename TDataSource , typename THasher >
void catapult::tree::BasePatriciaTreeDelta< TEncoder, TDataSource, THasher >::setCheckpoint ( )
inline

Marks all nodes reachable at this point.

◆ unset()

template<typename TEncoder , typename TDataSource , typename THasher >
bool catapult::tree::BasePatriciaTreeDelta< TEncoder, TDataSource, THasher >::unset ( const KeyType key)
inline

Removes the value associated with key from the tree.

Member Data Documentation

◆ m_baseRootHash

template<typename TEncoder , typename TDataSource , typename THasher >
Hash256 catapult::tree::BasePatriciaTreeDelta< TEncoder, TDataSource, THasher >::m_baseRootHash
private

◆ m_dataSource

template<typename TEncoder , typename TDataSource , typename THasher >
ReadThroughMemoryDataSource<TDataSource> catapult::tree::BasePatriciaTreeDelta< TEncoder, TDataSource, THasher >::m_dataSource
private

◆ m_tree

template<typename TEncoder , typename TDataSource , typename THasher >
PatriciaTree<TEncoder, ReadThroughMemoryDataSource<TDataSource> > catapult::tree::BasePatriciaTreeDelta< TEncoder, TDataSource, THasher >::m_tree
private

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