Kagome
Polkadot Runtime Engine in C++17
kagome::storage::face::MapCursor< K, V, KView > Struct Template Referenceabstract

An abstraction over generic map cursor. More...

#include <map_cursor.hpp>

Inheritance diagram for kagome::storage::face::MapCursor< K, V, KView >:
Collaboration diagram for kagome::storage::face::MapCursor< K, V, KView >:

Public Member Functions

virtual ~MapCursor ()=default
 
virtual outcome::result< bool > seekFirst ()=0
 Same as std::begin(...);. More...
 
virtual outcome::result< bool > seek (const KView &key)=0
 Find given key and seek iterator to this key. More...
 
virtual outcome::result< bool > seekLast ()=0
 Same as std::rbegin(...);, e.g. points to the last valid element. More...
 
virtual bool isValid () const =0
 Is the cursor in a valid state? More...
 
virtual outcome::result< void > next ()=0
 Make step forward. More...
 
virtual std::optional< K > key () const =0
 Getter for the key of the element currently pointed at. More...
 
virtual std::optional< V > value () const =0
 Getter for value of the element currently pointed at. More...
 

Detailed Description

template<typename K, typename V, typename KView = K>
struct kagome::storage::face::MapCursor< K, V, KView >

An abstraction over generic map cursor.

Template Parameters
Kkey type
Vvalue type
KViewkey view type

Definition at line 22 of file map_cursor.hpp.

Constructor & Destructor Documentation

template<typename K, typename V, typename KView = K>
virtual kagome::storage::face::MapCursor< K, V, KView >::~MapCursor ( )
virtualdefault

Member Function Documentation

template<typename K, typename V, typename KView = K>
virtual bool kagome::storage::face::MapCursor< K, V, KView >::isValid ( ) const
pure virtual

Is the cursor in a valid state?

Returns
true if the cursor points to an element of the map, false otherwise

Implemented in kagome::storage::trie::PolkadotTrieCursorImpl, and kagome::storage::RocksDBCursor.

template<typename K, typename V, typename KView = K>
virtual std::optional<K> kagome::storage::face::MapCursor< K, V, KView >::key ( ) const
pure virtual

Getter for the key of the element currently pointed at.

Returns
key if isValid()

Implemented in kagome::storage::trie::PolkadotTrieCursorImpl, and kagome::storage::RocksDBCursor.

template<typename K, typename V, typename KView = K>
virtual outcome::result<void> kagome::storage::face::MapCursor< K, V, KView >::next ( )
pure virtual
template<typename K, typename V, typename KView = K>
virtual outcome::result<bool> kagome::storage::face::MapCursor< K, V, KView >::seek ( const KView &  key)
pure virtual

Find given key and seek iterator to this key.

Returns
error if any, true if
  • key found, false otherwise

Implemented in kagome::storage::trie::PolkadotTrieCursorImpl.

template<typename K, typename V, typename KView = K>
virtual outcome::result<bool> kagome::storage::face::MapCursor< K, V, KView >::seekFirst ( )
pure virtual

Same as std::begin(...);.

Returns
error if any, true if trie is not empty, false otherwise

Implemented in kagome::storage::trie::PolkadotTrieCursorImpl, and kagome::storage::RocksDBCursor.

template<typename K, typename V, typename KView = K>
virtual outcome::result<bool> kagome::storage::face::MapCursor< K, V, KView >::seekLast ( )
pure virtual

Same as std::rbegin(...);, e.g. points to the last valid element.

Returns
error if any, true if trie is not empty, false otherwise

Implemented in kagome::storage::trie::PolkadotTrieCursorImpl, and kagome::storage::RocksDBCursor.

template<typename K, typename V, typename KView = K>
virtual std::optional<V> kagome::storage::face::MapCursor< K, V, KView >::value ( ) const
pure virtual

Getter for value of the element currently pointed at.

Returns
value if isValid()

Implemented in kagome::storage::trie::PolkadotTrieCursorImpl, and kagome::storage::RocksDBCursor.


The documentation for this struct was generated from the following file: