Kagome
Polkadot Runtime Engine in C++17
|
#include <trie_serializer_impl.hpp>
Public Member Functions | |
TrieSerializerImpl (std::shared_ptr< PolkadotTrieFactory > factory, std::shared_ptr< Codec > codec, std::shared_ptr< TrieStorageBackend > backend) | |
~TrieSerializerImpl () override=default | |
RootHash | getEmptyRootHash () const override |
outcome::result< RootHash > | storeTrie (PolkadotTrie &trie) override |
outcome::result< std::shared_ptr< PolkadotTrie > > | retrieveTrie (const common::Buffer &db_key) const override |
Public Member Functions inherited from kagome::storage::trie::TrieSerializer | |
virtual | ~TrieSerializer ()=default |
Private Member Functions | |
outcome::result< RootHash > | storeRootNode (TrieNode &node) |
outcome::result< PolkadotTrie::NodePtr > | retrieveNode (const common::Buffer &db_key) const |
outcome::result< PolkadotTrie::NodePtr > | retrieveNode (const std::shared_ptr< OpaqueTrieNode > &node) const |
Private Attributes | |
std::shared_ptr< PolkadotTrieFactory > | trie_factory_ |
std::shared_ptr< Codec > | codec_ |
std::shared_ptr< TrieStorageBackend > | backend_ |
Definition at line 23 of file trie_serializer_impl.hpp.
kagome::storage::trie::TrieSerializerImpl::TrieSerializerImpl | ( | std::shared_ptr< PolkadotTrieFactory > | factory, |
std::shared_ptr< Codec > | codec, | ||
std::shared_ptr< TrieStorageBackend > | backend | ||
) |
Definition at line 15 of file trie_serializer_impl.cpp.
|
overridedefault |
|
overridevirtual |
Implements kagome::storage::trie::TrieSerializer.
Definition at line 27 of file trie_serializer_impl.cpp.
|
private |
Fetches a node from the storage. A nullptr is returned in case that there is no entry for provided key. Mind that a branch node will have dummy nodes as its children
Definition at line 79 of file trie_serializer_impl.cpp.
|
private |
Retrieves a node, replacing a dummy node to an actual node if needed
Definition at line 70 of file trie_serializer_impl.cpp.
|
overridevirtual |
Fetches a trie from the storage. A nullptr is returned in case that there is no entry for provided key.
Implements kagome::storage::trie::TrieSerializer.
Definition at line 40 of file trie_serializer_impl.cpp.
|
private |
Writes a node to a persistent storage, recursively storing its descendants as well. Then replaces the node children to dummy nodes to avoid memory waste
Definition at line 54 of file trie_serializer_impl.cpp.
|
overridevirtual |
Writes a trie to a storage, recursively storing its nodes.
Implements kagome::storage::trie::TrieSerializer.
Definition at line 32 of file trie_serializer_impl.cpp.
|
private |
Definition at line 60 of file trie_serializer_impl.hpp.
|
private |
Definition at line 59 of file trie_serializer_impl.hpp.
|
private |
Definition at line 58 of file trie_serializer_impl.hpp.