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

A base patricia tree. More...

Inheritance diagram for catapult::tree::BasePatriciaTree< TEncoder, TDataSource, THasher >:

Public Types

using KeyType = typename TEncoder::KeyType
 
using ValueType = typename TEncoder::ValueType
 
using DeltaType = BasePatriciaTreeDelta< TEncoder, TDataSource, THasher >
 

Public Member Functions

 BasePatriciaTree (TDataSource &dataSource)
 Creates a tree around a dataSource. More...
 
 BasePatriciaTree (TDataSource &dataSource, const Hash256 &rootHash)
 Creates a tree around a dataSource with specified root hash (rootHash). More...
 
Hash256 root () const
 Gets the root hash that uniquely identifies this tree. More...
 
std::pair< Hash256, bool > lookup (const KeyType &key, std::vector< TreeNode > &nodePath) const
 Tries to find the value associated with key in the tree and stores proof of existence or not in nodePath. More...
 
std::shared_ptr< DeltaTyperebase ()
 Returns a delta based on the same data source as this tree. More...
 
std::shared_ptr< DeltaTyperebaseDetached () const
 
void commit ()
 Commits all changes in the rebased tree. More...
 

Private Attributes

TDataSource & m_dataSource
 
PatriciaTree< TEncoder, TDataSource > m_tree
 
std::weak_ptr< DeltaTypem_pWeakDelta
 

Detailed Description

template<typename TEncoder, typename TDataSource, typename THasher = std::hash<typename TEncoder::KeyType>>
class catapult::tree::BasePatriciaTree< TEncoder, TDataSource, THasher >

A base patricia tree.

Member Typedef Documentation

◆ DeltaType

template<typename TEncoder , typename TDataSource , typename THasher = std::hash<typename TEncoder::KeyType>>
using catapult::tree::BasePatriciaTree< TEncoder, TDataSource, THasher >::DeltaType = BasePatriciaTreeDelta<TEncoder, TDataSource, THasher>

◆ KeyType

template<typename TEncoder , typename TDataSource , typename THasher = std::hash<typename TEncoder::KeyType>>
using catapult::tree::BasePatriciaTree< TEncoder, TDataSource, THasher >::KeyType = typename TEncoder::KeyType

◆ ValueType

template<typename TEncoder , typename TDataSource , typename THasher = std::hash<typename TEncoder::KeyType>>
using catapult::tree::BasePatriciaTree< TEncoder, TDataSource, THasher >::ValueType = typename TEncoder::ValueType

Constructor & Destructor Documentation

◆ BasePatriciaTree() [1/2]

template<typename TEncoder , typename TDataSource , typename THasher = std::hash<typename TEncoder::KeyType>>
catapult::tree::BasePatriciaTree< TEncoder, TDataSource, THasher >::BasePatriciaTree ( TDataSource &  dataSource)
inlineexplicit

Creates a tree around a dataSource.

◆ BasePatriciaTree() [2/2]

template<typename TEncoder , typename TDataSource , typename THasher = std::hash<typename TEncoder::KeyType>>
catapult::tree::BasePatriciaTree< TEncoder, TDataSource, THasher >::BasePatriciaTree ( TDataSource &  dataSource,
const Hash256 rootHash 
)
inline

Creates a tree around a dataSource with specified root hash (rootHash).

Member Function Documentation

◆ commit()

template<typename TEncoder , typename TDataSource , typename THasher = std::hash<typename TEncoder::KeyType>>
void catapult::tree::BasePatriciaTree< TEncoder, TDataSource, THasher >::commit ( )
inline

Commits all changes in the rebased tree.

◆ lookup()

template<typename TEncoder , typename TDataSource , typename THasher = std::hash<typename TEncoder::KeyType>>
std::pair<Hash256, bool> catapult::tree::BasePatriciaTree< TEncoder, TDataSource, THasher >::lookup ( const KeyType key,
std::vector< TreeNode > &  nodePath 
) const
inline

Tries to find the value associated with key in the tree and stores proof of existence or not in nodePath.

◆ rebase()

template<typename TEncoder , typename TDataSource , typename THasher = std::hash<typename TEncoder::KeyType>>
std::shared_ptr<DeltaType> catapult::tree::BasePatriciaTree< TEncoder, TDataSource, THasher >::rebase ( )
inline

Returns a delta based on the same data source as this tree.

Here is the call graph for this function:

◆ rebaseDetached()

template<typename TEncoder , typename TDataSource , typename THasher = std::hash<typename TEncoder::KeyType>>
std::shared_ptr<DeltaType> catapult::tree::BasePatriciaTree< TEncoder, TDataSource, THasher >::rebaseDetached ( ) const
inline

Returns a delta based on the same data source as this tree but without the ability to commit any changes to the original tree.

Here is the call graph for this function:

◆ root()

template<typename TEncoder , typename TDataSource , typename THasher = std::hash<typename TEncoder::KeyType>>
Hash256 catapult::tree::BasePatriciaTree< TEncoder, TDataSource, THasher >::root ( ) const
inline

Gets the root hash that uniquely identifies this tree.

Here is the caller graph for this function:

Member Data Documentation

◆ m_dataSource

template<typename TEncoder , typename TDataSource , typename THasher = std::hash<typename TEncoder::KeyType>>
TDataSource& catapult::tree::BasePatriciaTree< TEncoder, TDataSource, THasher >::m_dataSource
private

◆ m_pWeakDelta

template<typename TEncoder , typename TDataSource , typename THasher = std::hash<typename TEncoder::KeyType>>
std::weak_ptr<DeltaType> catapult::tree::BasePatriciaTree< TEncoder, TDataSource, THasher >::m_pWeakDelta
private

◆ m_tree

template<typename TEncoder , typename TDataSource , typename THasher = std::hash<typename TEncoder::KeyType>>
PatriciaTree<TEncoder, TDataSource> catapult::tree::BasePatriciaTree< TEncoder, TDataSource, THasher >::m_tree
private

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