Kagome
Polkadot Runtime Engine in C++17
kagome::blockchain::CachedTree Class Reference

#include <cached_tree.hpp>

Collaboration diagram for kagome::blockchain::CachedTree:

Public Member Functions

 CachedTree (std::shared_ptr< TreeNode > root, std::shared_ptr< TreeMeta > metadata)
 
void updateTreeRoot (std::shared_ptr< TreeNode > new_trie_root, primitives::Justification justification)
 
void updateMeta (const std::shared_ptr< TreeNode > &new_node)
 
void removeFromMeta (const std::shared_ptr< TreeNode > &node)
 A reversal of updateMeta - it's called upon block tree branch prunung to remove pruned block from leaves list, update deepest node wptr etc. More...
 
TreeNode const & getRoot () const
 
TreeNodegetRoot ()
 
TreeMeta const & getMetadata () const
 

Private Attributes

std::shared_ptr< TreeNoderoot_
 
std::shared_ptr< TreeMetametadata_
 

Detailed Description

Non-finalized part of block tree

Definition at line 109 of file cached_tree.hpp.

Constructor & Destructor Documentation

kagome::blockchain::CachedTree::CachedTree ( std::shared_ptr< TreeNode root,
std::shared_ptr< TreeMeta metadata 
)
inlineexplicit

Definition at line 111 of file cached_tree.hpp.

Member Function Documentation

const TreeMeta & kagome::blockchain::CachedTree::getMetadata ( ) const

Definition at line 191 of file cached_tree.cpp.

TreeNode const & kagome::blockchain::CachedTree::getRoot ( ) const

Definition at line 181 of file cached_tree.cpp.

TreeNode & kagome::blockchain::CachedTree::getRoot ( )

Definition at line 186 of file cached_tree.cpp.

void kagome::blockchain::CachedTree::removeFromMeta ( const std::shared_ptr< TreeNode > &  node)

A reversal of updateMeta - it's called upon block tree branch prunung to remove pruned block from leaves list, update deepest node wptr etc.

Parameters
nodeRemoved node

Definition at line 208 of file cached_tree.cpp.

void kagome::blockchain::CachedTree::updateMeta ( const std::shared_ptr< TreeNode > &  new_node)

Definition at line 196 of file cached_tree.cpp.

void kagome::blockchain::CachedTree::updateTreeRoot ( std::shared_ptr< TreeNode new_trie_root,
primitives::Justification  justification 
)

Remove nodes in block tree from current tree_ to {

  • new_trie_root}. Needed to avoid cascade shared_ptr destructor calls which break the stack.
    Returns
    new tree root

Definition at line 161 of file cached_tree.cpp.

Member Data Documentation

std::shared_ptr<TreeMeta> kagome::blockchain::CachedTree::metadata_
private

Definition at line 143 of file cached_tree.hpp.

std::shared_ptr<TreeNode> kagome::blockchain::CachedTree::root_
private

Definition at line 142 of file cached_tree.hpp.


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