Kagome
Polkadot Runtime Engine in C++17
kagome::storage::trie::TrieStorageBackendBatch Class Reference

#include <trie_storage_backend_batch.hpp>

Inheritance diagram for kagome::storage::trie::TrieStorageBackendBatch:
Collaboration diagram for kagome::storage::trie::TrieStorageBackendBatch:

Public Member Functions

 TrieStorageBackendBatch (std::unique_ptr< face::WriteBatch< common::BufferView, common::Buffer >> storage_batch, common::Buffer node_prefix)
 
 ~TrieStorageBackendBatch () override=default
 
outcome::result< void > commit () override
 Writes batch. More...
 
outcome::result< void > put (const common::BufferView &key, const common::Buffer &value) override
 Store value by key. More...
 
outcome::result< void > put (const common::BufferView &key, common::Buffer &&value) override
 
outcome::result< void > remove (const common::BufferView &key) override
 Remove value by key. More...
 
void clear () override
 Clear batch. More...
 
- Public Member Functions inherited from kagome::storage::face::Writeable< common::BufferView, common::Buffer >
virtual ~Writeable ()=default
 

Private Member Functions

common::Buffer prefixKey (const common::BufferView &key) const
 

Private Attributes

std::unique_ptr< face::WriteBatch< common::BufferView, common::Buffer > > storage_batch_
 
common::Buffer node_prefix_
 

Detailed Description

Batch implementation for TrieStorageBackend

See also
TrieStorageBackend

Definition at line 18 of file trie_storage_backend_batch.hpp.

Constructor & Destructor Documentation

kagome::storage::trie::TrieStorageBackendBatch::TrieStorageBackendBatch ( std::unique_ptr< face::WriteBatch< common::BufferView, common::Buffer >>  storage_batch,
common::Buffer  node_prefix 
)

Definition at line 10 of file trie_storage_backend_batch.cpp.

kagome::storage::trie::TrieStorageBackendBatch::~TrieStorageBackendBatch ( )
overridedefault

Member Function Documentation

void kagome::storage::trie::TrieStorageBackendBatch::clear ( )
overridevirtual
outcome::result< void > kagome::storage::trie::TrieStorageBackendBatch::commit ( )
overridevirtual

Writes batch.

Returns
error code in case of error.

Implements kagome::storage::face::WriteBatch< common::BufferView, common::Buffer >.

Definition at line 19 of file trie_storage_backend_batch.cpp.

common::Buffer kagome::storage::trie::TrieStorageBackendBatch::prefixKey ( const common::BufferView key) const
private

Definition at line 42 of file trie_storage_backend_batch.cpp.

outcome::result< void > kagome::storage::trie::TrieStorageBackendBatch::put ( const common::BufferView key,
const common::Buffer value 
)
overridevirtual

Store value by key.

Parameters
keykey
valuevalue
Returns
result containing void if put successful, error otherwise

Implements kagome::storage::face::Writeable< common::BufferView, common::Buffer >.

Definition at line 27 of file trie_storage_backend_batch.cpp.

outcome::result< void > kagome::storage::trie::TrieStorageBackendBatch::put ( const common::BufferView key,
common::Buffer &&  value 
)
overridevirtual
outcome::result< void > kagome::storage::trie::TrieStorageBackendBatch::remove ( const common::BufferView key)
overridevirtual

Remove value by key.

Parameters
keyK
Returns
error code if error happened

Implements kagome::storage::face::Writeable< common::BufferView, common::Buffer >.

Definition at line 37 of file trie_storage_backend_batch.cpp.

Member Data Documentation

common::Buffer kagome::storage::trie::TrieStorageBackendBatch::node_prefix_
private

Definition at line 43 of file trie_storage_backend_batch.hpp.

std::unique_ptr<face::WriteBatch<common::BufferView, common::Buffer> > kagome::storage::trie::TrieStorageBackendBatch::storage_batch_
private

Definition at line 42 of file trie_storage_backend_batch.hpp.


The documentation for this class was generated from the following files: