6 #ifndef KAGOME_CORE_STORAGE_TRIE_IMPL_TOPPER_TRIE_BATCH_IMPL 7 #define KAGOME_CORE_STORAGE_TRIE_IMPL_TOPPER_TRIE_BATCH_IMPL 16 class PolkadotTrieCursor;
27 outcome::result<common::BufferConstRef>
get(
29 outcome::result<std::optional<common::BufferConstRef>>
tryGet(
35 std::unique_ptr<PolkadotTrieCursor>
trieCursor()
override;
37 bool empty()
const override;
40 const Buffer &value)
override;
42 outcome::result<void>
remove(
const BufferView &key)
override;
43 outcome::result<std::tuple<bool, uint32_t>>
clearPrefix(
44 const BufferView &prefix, std::optional<uint64_t> limit)
override;
46 outcome::result<void>
writeBack()
override;
51 std::map<Buffer, std::optional<Buffer>, std::less<>>
cache_;
60 #endif // KAGOME_CORE_STORAGE_TRIE_IMPL_TOPPER_TRIE_BATCH_IMPL Class represents arbitrary (including empty) byte buffer.
outcome::result< std::optional< common::BufferConstRef > > tryGet(const BufferView &key) const override
Get value by key.
std::map< Buffer, std::optional< Buffer >, std::less<> > cache_
outcome::result< void > put(const BufferView &key, const Buffer &value) override
Store value by key.
bool empty() const override
Returns true if the storage is empty.
OUTCOME_HPP_DECLARE_ERROR(kagome::api, JRpcServerImpl::Error)
std::deque< Buffer > cleared_prefixes_
TopperTrieBatchImpl(const std::shared_ptr< TrieBatch > &parent)
bool wasClearedByPrefix(const BufferView &key) const
outcome::result< std::tuple< bool, uint32_t > > clearPrefix(const BufferView &prefix, std::optional< uint64_t > limit) override
std::weak_ptr< TrieBatch > parent_
outcome::result< void > writeBack() override
std::unique_ptr< PolkadotTrieCursor > trieCursor() override
outcome::result< bool > contains(const BufferView &key) const override
Checks if given key-value binding exists in the storage.