Kagome
Polkadot Runtime Engine in C++17
|
#include <polkadot_trie_cursor_impl.hpp>
Classes | |
struct | InvalidState |
struct | ReachedEndState |
class | SearchState |
struct | TriePathEntry |
struct | UninitializedState |
Public Types | |
enum | Error { Error::INVALID_NODE_TYPE = 1, Error::INVALID_CURSOR_ACCESS, Error::KEY_NOT_FOUND } |
using | NodeType = TrieNode::Type |
Public Member Functions | |
PolkadotTrieCursorImpl (std::shared_ptr< const PolkadotTrie > trie) | |
~PolkadotTrieCursorImpl () override=default | |
outcome::result< bool > | seekFirst () override |
Same as std::begin(...);. More... | |
outcome::result< bool > | seek (const common::BufferView &key) override |
Find given key and seek iterator to this key. More... | |
outcome::result< bool > | seekLast () override |
Same as std::rbegin(...);, e.g. points to the last valid element. More... | |
outcome::result< void > | seekLowerBound (const common::BufferView &key) override |
outcome::result< void > | seekUpperBound (const common::BufferView &key) override |
bool | isValid () const override |
Is the cursor in a valid state? More... | |
outcome::result< void > | next () override |
Make step forward. More... | |
std::optional< common::Buffer > | key () const override |
Getter for the key of the element currently pointed at. More... | |
std::optional< common::BufferConstRef > | value () const override |
Getter for value of the element currently pointed at. More... | |
Public Member Functions inherited from kagome::storage::trie::PolkadotTrieCursor | |
virtual | ~PolkadotTrieCursor () override=default |
Public Member Functions inherited from kagome::storage::face::MapCursor< common::Buffer, common::BufferConstRef, common::BufferView > | |
virtual | ~MapCursor ()=default |
Static Public Member Functions | |
static outcome::result< std::unique_ptr< PolkadotTrieCursorImpl > > | createAt (const common::BufferView &key, const std::shared_ptr< const PolkadotTrie > &trie) |
Private Types | |
using | CursorState = std::variant< UninitializedState, SearchState, InvalidState, ReachedEndState > |
Private Member Functions | |
outcome::result< void > | seekLowerBoundInternal (const TrieNode ¤t, gsl::span< const uint8_t > left_nibbles) |
outcome::result< bool > | nextNodeWithValueInOuterTree () |
outcome::result< void > | nextNodeWithValueInSubTree (const TrieNode &subtree_root) |
outcome::result< const TrieNode * > | visitChildWithMinIdx (const TrieNode &node, uint8_t min_idx=0) |
auto | makeSearchStateAt (const common::BufferView &key) -> outcome::result< SearchState > |
common::Buffer | collectKey () const |
template<typename Res > | |
outcome::result< Res > | safeAccess (outcome::result< Res > &&result) |
Private Attributes | |
PolkadotCodec | codec_ |
log::Logger | log_ |
std::shared_ptr< const PolkadotTrie > | trie_ |
CursorState | state_ |
Definition at line 18 of file polkadot_trie_cursor_impl.hpp.
struct kagome::storage::trie::PolkadotTrieCursorImpl::InvalidState |
Definition at line 140 of file polkadot_trie_cursor_impl.hpp.
Class Members | ||
---|---|---|
error_code | code |
struct kagome::storage::trie::PolkadotTrieCursorImpl::ReachedEndState |
Definition at line 147 of file polkadot_trie_cursor_impl.hpp.
struct kagome::storage::trie::PolkadotTrieCursorImpl::UninitializedState |
Definition at line 145 of file polkadot_trie_cursor_impl.hpp.
|
private |
Definition at line 175 of file polkadot_trie_cursor_impl.hpp.
Definition at line 20 of file polkadot_trie_cursor_impl.hpp.
Enumerator | |
---|---|
INVALID_NODE_TYPE | |
INVALID_CURSOR_ACCESS | |
KEY_NOT_FOUND |
Definition at line 22 of file polkadot_trie_cursor_impl.hpp.
|
explicit |
Definition at line 44 of file polkadot_trie_cursor_impl.cpp.
|
overridedefault |
|
private |
Definition at line 352 of file polkadot_trie_cursor_impl.cpp.
|
static |
Definition at line 53 of file polkadot_trie_cursor_impl.cpp.
|
overridevirtual |
Is the cursor in a valid state?
Implements kagome::storage::face::MapCursor< common::Buffer, common::BufferConstRef, common::BufferView >.
Definition at line 301 of file polkadot_trie_cursor_impl.cpp.
|
overridevirtual |
Getter for the key of the element currently pointed at.
Implements kagome::storage::face::MapCursor< common::Buffer, common::BufferConstRef, common::BufferView >.
Definition at line 368 of file polkadot_trie_cursor_impl.cpp.
|
private |
Constructs a list of branch nodes on the path from the root to the node with the given
Definition at line 389 of file polkadot_trie_cursor_impl.cpp.
|
overridevirtual |
Make step forward.
Implements kagome::storage::face::MapCursor< common::Buffer, common::BufferConstRef, common::BufferView >.
Definition at line 305 of file polkadot_trie_cursor_impl.cpp.
|
private |
Definition at line 236 of file polkadot_trie_cursor_impl.cpp.
|
private |
Definition at line 257 of file polkadot_trie_cursor_impl.cpp.
|
inlineprivate |
Definition at line 162 of file polkadot_trie_cursor_impl.hpp.
|
overridevirtual |
Find given key and seek iterator to this key.
Implements kagome::storage::face::MapCursor< common::Buffer, common::BufferConstRef, common::BufferView >.
Definition at line 68 of file polkadot_trie_cursor_impl.cpp.
|
overridevirtual |
Same as std::begin(...);.
Implements kagome::storage::face::MapCursor< common::Buffer, common::BufferConstRef, common::BufferView >.
Definition at line 62 of file polkadot_trie_cursor_impl.cpp.
|
overridevirtual |
Same as std::rbegin(...);, e.g. points to the last valid element.
Implements kagome::storage::face::MapCursor< common::Buffer, common::BufferConstRef, common::BufferView >.
Definition at line 97 of file polkadot_trie_cursor_impl.cpp.
|
overridevirtual |
Seek the first element with key not less than
Implements kagome::storage::trie::PolkadotTrieCursor.
Definition at line 223 of file polkadot_trie_cursor_impl.cpp.
|
private |
Definition at line 130 of file polkadot_trie_cursor_impl.cpp.
|
overridevirtual |
Seek the first element with key greater than
Implements kagome::storage::trie::PolkadotTrieCursor.
Definition at line 274 of file polkadot_trie_cursor_impl.cpp.
|
overridevirtual |
Getter for value of the element currently pointed at.
Implements kagome::storage::face::MapCursor< common::Buffer, common::BufferConstRef, common::BufferView >.
Definition at line 376 of file polkadot_trie_cursor_impl.cpp.
|
private |
Definition at line 285 of file polkadot_trie_cursor_impl.cpp.
|
private |
Definition at line 158 of file polkadot_trie_cursor_impl.hpp.
|
private |
Definition at line 159 of file polkadot_trie_cursor_impl.hpp.
|
private |
Definition at line 176 of file polkadot_trie_cursor_impl.hpp.
|
private |
Definition at line 172 of file polkadot_trie_cursor_impl.hpp.