Kagome
Polkadot Runtime Engine in C++17
trie_storage_backend_batch.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_STORAGE_TRIE_IMPL_TRIE_STORAGE_BACKEND_BATCH
7 #define KAGOME_STORAGE_TRIE_IMPL_TRIE_STORAGE_BACKEND_BATCH
8 
9 #include "common/buffer.hpp"
11 
12 namespace kagome::storage::trie {
13 
19  : public face::WriteBatch<common::BufferView, common::Buffer> {
20  public:
23  storage_batch,
24  common::Buffer node_prefix);
25  ~TrieStorageBackendBatch() override = default;
26 
27  outcome::result<void> commit() override;
28 
29  outcome::result<void> put(const common::BufferView &key,
30  const common::Buffer &value) override;
31 
32  outcome::result<void> put(const common::BufferView &key,
33  common::Buffer &&value) override;
34 
35  outcome::result<void> remove(const common::BufferView &key) override;
36  void clear() override;
37 
38  private:
40 
41  std::unique_ptr<face::WriteBatch<common::BufferView, common::Buffer>>
44  };
45 
46 } // namespace kagome::storage::trie
47 
48 #endif // KAGOME_STORAGE_TRIE_IMPL_TRIE_STORAGE_BACKEND_BATCH
Class represents arbitrary (including empty) byte buffer.
Definition: buffer.hpp:29
An abstraction over a storage, which can be used for batch writes.
Definition: write_batch.hpp:19
TrieStorageBackendBatch(std::unique_ptr< face::WriteBatch< common::BufferView, common::Buffer >> storage_batch, common::Buffer node_prefix)
outcome::result< void > commit() override
Writes batch.
outcome::result< void > put(const common::BufferView &key, const common::Buffer &value) override
Store value by key.
common::Buffer prefixKey(const common::BufferView &key) const
std::unique_ptr< face::WriteBatch< common::BufferView, common::Buffer > > storage_batch_