Kagome
Polkadot Runtime Engine in C++17
kagome::storage::RocksDBCursor Class Reference

#include <rocksdb_cursor.hpp>

Inheritance diagram for kagome::storage::RocksDBCursor:
Collaboration diagram for kagome::storage::RocksDBCursor:

Public Member Functions

 ~RocksDBCursor () override=default
 
 RocksDBCursor (std::shared_ptr< rocksdb::Iterator > it)
 
outcome::result< bool > seekFirst () override
 Same as std::begin(...);. More...
 
outcome::result< bool > seek (const BufferView &key) override
 
outcome::result< bool > seekLast () override
 Same as std::rbegin(...);, e.g. points to the last valid element. More...
 
bool isValid () const override
 Is the cursor in a valid state? More...
 
outcome::result< void > next () override
 Make step forward. More...
 
std::optional< Bufferkey () const override
 Getter for the key of the element currently pointed at. More...
 
std::optional< Buffervalue () const override
 Getter for value of the element currently pointed at. More...
 
- Public Member Functions inherited from kagome::storage::face::MapCursor< K, V, KView >
virtual ~MapCursor ()=default
 
virtual outcome::result< bool > seek (const KView &key)=0
 Find given key and seek iterator to this key. More...
 

Private Attributes

std::shared_ptr< rocksdb::Iterator > i_
 

Detailed Description

Definition at line 14 of file rocksdb_cursor.hpp.

Constructor & Destructor Documentation

kagome::storage::RocksDBCursor::~RocksDBCursor ( )
overridedefault
kagome::storage::RocksDBCursor::RocksDBCursor ( std::shared_ptr< rocksdb::Iterator >  it)
explicit

Definition at line 12 of file rocksdb_cursor.cpp.

Member Function Documentation

bool kagome::storage::RocksDBCursor::isValid ( ) const
overridevirtual

Is the cursor in a valid state?

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

Implements kagome::storage::face::MapCursor< K, V, KView >.

Definition at line 30 of file rocksdb_cursor.cpp.

std::optional< Buffer > kagome::storage::RocksDBCursor::key ( ) const
overridevirtual

Getter for the key of the element currently pointed at.

Returns
key if isValid()

Implements kagome::storage::face::MapCursor< K, V, KView >.

Definition at line 39 of file rocksdb_cursor.cpp.

outcome::result< void > kagome::storage::RocksDBCursor::next ( )
overridevirtual

Make step forward.

Implements kagome::storage::face::MapCursor< K, V, KView >.

Definition at line 34 of file rocksdb_cursor.cpp.

outcome::result< bool > kagome::storage::RocksDBCursor::seek ( const BufferView key)
override

Definition at line 20 of file rocksdb_cursor.cpp.

outcome::result< bool > kagome::storage::RocksDBCursor::seekFirst ( )
overridevirtual

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

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

Implements kagome::storage::face::MapCursor< K, V, KView >.

Definition at line 15 of file rocksdb_cursor.cpp.

outcome::result< bool > kagome::storage::RocksDBCursor::seekLast ( )
overridevirtual

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

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

Implements kagome::storage::face::MapCursor< K, V, KView >.

Definition at line 25 of file rocksdb_cursor.cpp.

std::optional< Buffer > kagome::storage::RocksDBCursor::value ( ) const
overridevirtual

Getter for value of the element currently pointed at.

Returns
value if isValid()

Implements kagome::storage::face::MapCursor< K, V, KView >.

Definition at line 44 of file rocksdb_cursor.cpp.

Member Data Documentation

std::shared_ptr<rocksdb::Iterator> kagome::storage::RocksDBCursor::i_
private

Definition at line 35 of file rocksdb_cursor.hpp.


The documentation for this class was generated from the following files: