Kagome
Polkadot Runtime Engine in C++17
|
Internal codec for nodes in the Trie. Eth and substrate have different codecs, but rest of the code should be same. More...
#include <codec.hpp>
Public Types | |
using | StoreChildren = std::function< outcome::result< void >(common::BufferView, common::Buffer &&)> |
Public Member Functions | |
virtual | ~Codec ()=default |
virtual outcome::result< common::Buffer > | encodeNodeAndStoreChildren (const Node &node, const StoreChildren &store_children) const =0 |
Encode node to byte representation and store children. More... | |
outcome::result< common::Buffer > | encodeNode (const Node &node) const |
Encode node to byte representation. More... | |
virtual outcome::result< std::shared_ptr< Node > > | decodeNode (gsl::span< const uint8_t > encoded_data) const =0 |
Decode node from bytes. More... | |
virtual common::Buffer | merkleValue (const common::BufferView &buf) const =0 |
Get the merkle value of a node. More... | |
virtual bool | isMerkleHash (const common::BufferView &buf) const =0 |
is this a hash of value, or value itself More... | |
virtual common::Hash256 | hash256 (const common::BufferView &buf) const =0 |
Get the hash of a node. More... | |
Internal codec for nodes in the Trie. Eth and substrate have different codecs, but rest of the code should be same.
using kagome::storage::trie::Codec::StoreChildren = std::function<outcome::result<void>( common::BufferView, common::Buffer &&)> |
|
virtualdefault |
|
pure virtual |
Decode node from bytes.
encoded_data | a buffer containing encoded representation of a node |
Implemented in kagome::storage::trie::PolkadotCodec.
|
inline |
|
pure virtual |
Encode node to byte representation and store children.
node | node in the trie |
store_children | chidren storer |
node} |
Implemented in kagome::storage::trie::PolkadotCodec.
|
pure virtual |
Get the hash of a node.
buf | byte representation of the node |
buf |
Implemented in kagome::storage::trie::PolkadotCodec.
|
pure virtual |
is this a hash of value, or value itself
Implemented in kagome::storage::trie::PolkadotCodec.
|
pure virtual |
Get the merkle value of a node.
buf | byte representation of the node |
buf | or |
buf | if it is shorter than the hash |
Implemented in kagome::storage::trie::PolkadotCodec.