Kagome
Polkadot Runtime Engine in C++17
rocksdb_batch.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_ROCKSDB_BATCH_HPP
7 #define KAGOME_ROCKSDB_BATCH_HPP
8 
9 #include <rocksdb/write_batch.h>
11 
12 namespace kagome::storage {
13 
14  class RocksDB::Batch : public BufferBatch {
15  public:
16  ~Batch() override = default;
17 
18  explicit Batch(RocksDB &db);
19 
20  outcome::result<void> commit() override;
21 
22  void clear() override;
23 
24  outcome::result<void> put(const BufferView &key,
25  const Buffer &value) override;
26 
27  outcome::result<void> put(const BufferView &key, Buffer &&value) override;
28 
29  outcome::result<void> remove(const BufferView &key) override;
30 
31  private:
33  rocksdb::WriteBatch batch_;
34  };
35 } // namespace kagome::storage
36 
37 #endif // KAGOME_ROCKSDB_BATCH_HPP
Class represents arbitrary (including empty) byte buffer.
Definition: buffer.hpp:29
void clear() override
Clear batch.
outcome::result< void > commit() override
Writes batch.
outcome::result< void > put(const BufferView &key, const Buffer &value) override