Kagome
Polkadot Runtime Engine in C++17
|
#include <cached_tree.hpp>
Public Types | |
enum | Error { Error::NO_CHAIN_BETWEEN_BLOCKS = 1 } |
enum | ExitToken { ExitToken::EXIT, ExitToken::CONTINUE } |
Public Member Functions | |
TreeNode (const primitives::BlockHash &hash, primitives::BlockNumber depth, bool finalized=false) | |
TreeNode (const primitives::BlockHash &hash, primitives::BlockNumber depth, const std::shared_ptr< TreeNode > &parent, bool finalized=false) | |
std::shared_ptr< const TreeNode > | findByHash (const primitives::BlockHash &hash) const |
std::shared_ptr< TreeNode > | findByHash (const primitives::BlockHash &hash) |
outcome::result< void > | applyToChain (const primitives::BlockInfo &chain_end, std::function< outcome::result< ExitToken >(TreeNode const &node)> const &op) const |
primitives::BlockInfo | getBlockInfo () const |
bool | operator== (const TreeNode &other) const |
bool | operator!= (const TreeNode &other) const |
Public Attributes | |
primitives::BlockHash | block_hash |
primitives::BlockNumber | depth |
std::weak_ptr< TreeNode > | parent |
bool | finalized |
std::vector< std::shared_ptr< TreeNode > > | children {} |
In-memory light representation of the tree, used for efficiency and usage convenience - we would only ask the database for some info, when directly requested
Definition at line 24 of file cached_tree.hpp.
|
strong |
Enumerator | |
---|---|
NO_CHAIN_BETWEEN_BLOCKS |
Definition at line 26 of file cached_tree.hpp.
|
strong |
Exit token for applyToChain method. Simply a value denoting whether applyToChain should stop.
Enumerator | |
---|---|
EXIT | |
CONTINUE |
Definition at line 60 of file cached_tree.hpp.
kagome::blockchain::TreeNode::TreeNode | ( | const primitives::BlockHash & | hash, |
primitives::BlockNumber | depth, | ||
bool | finalized = false |
||
) |
Definition at line 23 of file cached_tree.cpp.
kagome::blockchain::TreeNode::TreeNode | ( | const primitives::BlockHash & | hash, |
primitives::BlockNumber | depth, | ||
const std::shared_ptr< TreeNode > & | parent, | ||
bool | finalized = false |
||
) |
Definition at line 28 of file cached_tree.cpp.
outcome::result< void > kagome::blockchain::TreeNode::applyToChain | ( | const primitives::BlockInfo & | chain_end, |
std::function< outcome::result< ExitToken >(TreeNode const &node)> const & | op | ||
) | const |
Applies
Definition at line 34 of file cached_tree.cpp.
std::shared_ptr< const TreeNode > kagome::blockchain::TreeNode::findByHash | ( | const primitives::BlockHash & | hash | ) | const |
Get a node of the tree, containing block with the specified hash, if it can be found
Definition at line 88 of file cached_tree.cpp.
|
inline |
Definition at line 51 of file cached_tree.hpp.
|
inline |
Definition at line 77 of file cached_tree.hpp.
bool kagome::blockchain::TreeNode::operator!= | ( | const TreeNode & | other | ) | const |
Definition at line 116 of file cached_tree.cpp.
bool kagome::blockchain::TreeNode::operator== | ( | const TreeNode & | other | ) | const |
Definition at line 106 of file cached_tree.cpp.
primitives::BlockHash kagome::blockchain::TreeNode::block_hash |
Definition at line 37 of file cached_tree.hpp.
std::vector<std::shared_ptr<TreeNode> > kagome::blockchain::TreeNode::children {} |
Definition at line 42 of file cached_tree.hpp.
primitives::BlockNumber kagome::blockchain::TreeNode::depth |
Definition at line 38 of file cached_tree.hpp.
bool kagome::blockchain::TreeNode::finalized |
Definition at line 40 of file cached_tree.hpp.
std::weak_ptr<TreeNode> kagome::blockchain::TreeNode::parent |
Definition at line 39 of file cached_tree.hpp.