6 #ifndef KAGOME_ROCKSDB_CURSOR_HPP 7 #define KAGOME_ROCKSDB_CURSOR_HPP 9 #include <rocksdb/iterator.h> 18 explicit RocksDBCursor(std::shared_ptr<rocksdb::Iterator> it);
20 outcome::result<bool>
seekFirst()
override;
24 outcome::result<bool>
seekLast()
override;
28 outcome::result<void>
next()
override;
30 std::optional<Buffer>
key()
const override;
32 std::optional<Buffer>
value()
const override;
35 std::shared_ptr<rocksdb::Iterator>
i_;
40 #endif // KAGOME_ROCKSDB_CURSOR_HPP
An abstraction over generic map cursor.
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)