Kagome
Polkadot Runtime Engine in C++17
|
#include <polkadot_trie_impl.hpp>
Public Member Functions | |
PolkadotTrieImpl (PolkadotTrie::NodeRetrieveFunctor f=PolkadotTrie::defaultNodeRetrieveFunctor) | |
PolkadotTrieImpl (NodePtr root, PolkadotTrie::NodeRetrieveFunctor f=PolkadotTrie::defaultNodeRetrieveFunctor) | |
~PolkadotTrieImpl () | |
NodePtr | getRoot () override |
ConstNodePtr | getRoot () const override |
outcome::result< NodePtr > | getNode (ConstNodePtr parent, const NibblesView &key_nibbles) override |
outcome::result< ConstNodePtr > | getNode (ConstNodePtr parent, const NibblesView &key_nibbles) const override |
outcome::result< void > | forNodeInPath (ConstNodePtr parent, const NibblesView &path, const std::function< outcome::result< void >(BranchNode const &, uint8_t idx)> &callback) const override |
outcome::result< std::tuple< bool, uint32_t > > | clearPrefix (const common::BufferView &prefix, std::optional< uint64_t > limit, const OnDetachCallback &callback) override |
outcome::result< void > | put (const common::BufferView &key, const common::Buffer &value) override |
Store value by key. More... | |
outcome::result< void > | put (const common::BufferView &key, common::Buffer &&value) override |
outcome::result< void > | remove (const common::BufferView &key) override |
Remove value by key. More... | |
outcome::result< common::BufferConstRef > | get (const common::BufferView &key) const override |
Get value by key. More... | |
outcome::result< std::optional< common::BufferConstRef > > | tryGet (const common::BufferView &key) const override |
Get value by key. More... | |
std::unique_ptr< PolkadotTrieCursor > | trieCursor () override |
outcome::result< bool > | contains (const common::BufferView &key) const override |
Checks if given key-value binding exists in the storage. More... | |
bool | empty () const override |
Returns true if the storage is empty. More... | |
outcome::result< ConstNodePtr > | retrieveChild (const BranchNode &parent, uint8_t idx) const override |
outcome::result< NodePtr > | retrieveChild (const BranchNode &parent, uint8_t idx) override |
Public Member Functions inherited from kagome::storage::trie::PolkadotTrie | |
std::unique_ptr< Cursor > | cursor () final |
Returns new key-value iterator. More... | |
Public Member Functions inherited from kagome::storage::face::Iterable< common::Buffer, ReadableMap< common::Buffer, common::Buffer >::ConstValueView, common::BufferView > | |
virtual | ~Iterable ()=default |
Public Member Functions inherited from kagome::storage::face::ReadableMap< common::BufferView, common::Buffer > | |
virtual | ~ReadableMap ()=default |
Public Member Functions inherited from kagome::storage::face::ReadableBase< common::BufferView > | |
virtual | ~ReadableBase ()=default |
Public Member Functions inherited from kagome::storage::face::Writeable< common::BufferView, common::Buffer > | |
virtual | ~Writeable ()=default |
Private Member Functions | |
outcome::result< NodePtr > | insert (const NodePtr &parent, const NibblesView &key_nibbles, NodePtr node) |
outcome::result< NodePtr > | updateBranch (BranchPtr parent, const NibblesView &key_nibbles, const NodePtr &node) |
Private Attributes | |
std::unique_ptr< OpaqueNodeStorage > | nodes_ |
log::Logger | logger_ |
Additional Inherited Members | |
Static Public Member Functions inherited from kagome::storage::trie::PolkadotTrie | |
static outcome::result< NodePtr > | defaultNodeRetrieveFunctor (const std::shared_ptr< OpaqueTrieNode > &node) |
Definition at line 19 of file polkadot_trie_impl.hpp.
|
strong |
Enumerator | |
---|---|
INVALID_NODE_TYPE |
Definition at line 23 of file polkadot_trie_impl.hpp.
|
explicit |
Creates an empty Trie
f | a functor that will be used to obtain a child of a branch node by its index. Most useful if Trie grows too big to occupy main memory and is stored on an external storage |
Definition at line 286 of file polkadot_trie_impl.cpp.
|
explicit |
Definition at line 290 of file polkadot_trie_impl.cpp.
kagome::storage::trie::PolkadotTrieImpl::~PolkadotTrieImpl | ( | ) |
Definition at line 294 of file polkadot_trie_impl.cpp.
|
overridevirtual |
Remove all entries, which key starts with the prefix
Implements kagome::storage::trie::PolkadotTrie.
Definition at line 326 of file polkadot_trie_impl.cpp.
|
overridevirtual |
Checks if given key-value binding exists in the storage.
key | K |
Implements kagome::storage::face::ReadableBase< common::BufferView >.
Definition at line 606 of file polkadot_trie_impl.cpp.
|
overridevirtual |
Returns true if the storage is empty.
Implements kagome::storage::face::ReadableBase< common::BufferView >.
Definition at line 617 of file polkadot_trie_impl.cpp.
|
overridevirtual |
Invokes callback on each node starting from
Implements kagome::storage::trie::PolkadotTrie.
Definition at line 542 of file polkadot_trie_impl.cpp.
|
overridevirtual |
Get value by key.
key | K |
Implements kagome::storage::face::ReadableMap< common::BufferView, common::Buffer >.
Definition at line 460 of file polkadot_trie_impl.cpp.
|
overridevirtual |
Implements kagome::storage::trie::PolkadotTrie.
Definition at line 482 of file polkadot_trie_impl.cpp.
|
overridevirtual |
Implements kagome::storage::trie::PolkadotTrie.
Definition at line 494 of file polkadot_trie_impl.cpp.
|
overridevirtual |
Implements kagome::storage::trie::PolkadotTrie.
Definition at line 306 of file polkadot_trie_impl.cpp.
|
overridevirtual |
Implements kagome::storage::trie::PolkadotTrie.
Definition at line 302 of file polkadot_trie_impl.cpp.
|
private |
Definition at line 340 of file polkadot_trie_impl.cpp.
|
overridevirtual |
Store value by key.
key | key |
value | value |
Implements kagome::storage::face::Writeable< common::BufferView, common::Buffer >.
Definition at line 296 of file polkadot_trie_impl.cpp.
|
overridevirtual |
Implements kagome::storage::face::Writeable< common::BufferView, common::Buffer >.
Definition at line 310 of file polkadot_trie_impl.cpp.
|
overridevirtual |
Remove value by key.
key | K |
Implements kagome::storage::face::Writeable< common::BufferView, common::Buffer >.
Definition at line 621 of file polkadot_trie_impl.cpp.
|
overridevirtual |
Implements kagome::storage::trie::PolkadotTrie.
Definition at line 634 of file polkadot_trie_impl.cpp.
|
overridevirtual |
Implements kagome::storage::trie::PolkadotTrie.
Definition at line 640 of file polkadot_trie_impl.cpp.
|
overridevirtual |
Implements kagome::storage::trie::PolkadotTrie.
Definition at line 602 of file polkadot_trie_impl.cpp.
|
overridevirtual |
Get value by key.
key | K |
Implements kagome::storage::face::ReadableMap< common::BufferView, common::Buffer >.
Definition at line 470 of file polkadot_trie_impl.cpp.
|
private |
Definition at line 423 of file polkadot_trie_impl.cpp.
|
private |
Definition at line 99 of file polkadot_trie_impl.hpp.
|
private |
Definition at line 97 of file polkadot_trie_impl.hpp.