Kagome
Polkadot Runtime Engine in C++17
rocksdb_cursor.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_ROCKSDB_CURSOR_HPP
7 #define KAGOME_ROCKSDB_CURSOR_HPP
8 
9 #include <rocksdb/iterator.h>
11 
12 namespace kagome::storage {
13 
15  public:
16  ~RocksDBCursor() override = default;
17 
18  explicit RocksDBCursor(std::shared_ptr<rocksdb::Iterator> it);
19 
20  outcome::result<bool> seekFirst() override;
21 
22  outcome::result<bool> seek(const BufferView &key) override;
23 
24  outcome::result<bool> seekLast() override;
25 
26  bool isValid() const override;
27 
28  outcome::result<void> next() override;
29 
30  std::optional<Buffer> key() const override;
31 
32  std::optional<Buffer> value() const override;
33 
34  private:
35  std::shared_ptr<rocksdb::Iterator> i_;
36  };
37 
38 } // namespace kagome::storage
39 
40 #endif // KAGOME_ROCKSDB_CURSOR_HPP
An abstraction over generic map cursor.
Definition: map_cursor.hpp:22
outcome::result< void > next() override
Make step forward.
outcome::result< bool > seekLast() override
Same as std::rbegin(...);, e.g. points to the last valid element.
~RocksDBCursor() override=default
outcome::result< bool > seek(const BufferView &key) override
std::optional< Buffer > value() const override
Getter for value of the element currently pointed at.
outcome::result< bool > seekFirst() override
Same as std::begin(...);.
bool isValid() const override
Is the cursor in a valid state?
std::shared_ptr< rocksdb::Iterator > i_
std::optional< Buffer > key() const override
Getter for the key of the element currently pointed at.
RocksDBCursor(std::shared_ptr< rocksdb::Iterator > it)