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

#include <trie_storage_backend_impl.hpp>

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

Public Member Functions

 TrieStorageBackendImpl (std::shared_ptr< BufferStorage > storage, common::Buffer node_prefix)
 
 ~TrieStorageBackendImpl () override=default
 
std::unique_ptr< Cursorcursor () override
 Returns new key-value iterator. More...
 
std::unique_ptr< face::WriteBatch< BufferView, Buffer > > batch () override
 Creates new Write Batch - an object, which can be used to efficiently write bulk data. More...
 
outcome::result< Bufferload (const BufferView &key) const override
 
outcome::result< std::optional< Buffer > > tryLoad (const BufferView &key) const override
 
outcome::result< bool > contains (const BufferView &key) const override
 
bool empty () const override
 Returns true if the storage is empty. More...
 
outcome::result< void > put (const BufferView &key, const Buffer &value) override
 
outcome::result< void > put (const BufferView &key, Buffer &&value) override
 
outcome::result< void > remove (const common::BufferView &key) override
 
size_t size () const override
 
- Public Member Functions inherited from kagome::storage::trie::TrieStorageBackend
 ~TrieStorageBackend () override=default
 
- Public Member Functions inherited from kagome::storage::face::Iterable< K, V, KView >
virtual ~Iterable ()=default
 
- Public Member Functions inherited from kagome::storage::face::ReadableStorage< KView, V >
virtual ~ReadableStorage ()=default
 
virtual outcome::result< V > load (const Key &key) const =0
 Load value by key. More...
 
virtual outcome::result< std::optional< V > > tryLoad (const Key &key) const =0
 Load value by key. More...
 
- Public Member Functions inherited from kagome::storage::face::ReadableBase< KView >
virtual ~ReadableBase ()=default
 
virtual outcome::result< bool > contains (const Key &key) const =0
 Checks if given key-value binding exists in the storage. More...
 
- Public Member Functions inherited from kagome::storage::face::Writeable< KView, V >
virtual ~Writeable ()=default
 
virtual outcome::result< void > put (const KView &key, const V &value)=0
 Store value by key. More...
 
virtual outcome::result< void > put (const KView &key, V &&value)=0
 
virtual outcome::result< void > remove (const KView &key)=0
 Remove value by key. More...
 
- Public Member Functions inherited from kagome::storage::face::BatchWriteable< KView, V >
virtual ~BatchWriteable ()=default
 

Private Member Functions

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

Private Attributes

std::shared_ptr< BufferStoragestorage_
 
common::Buffer node_prefix_
 

Additional Inherited Members

- Public Types inherited from kagome::storage::face::Iterable< K, V, KView >
using Cursor = MapCursor< K, V, KView >
 
- Public Types inherited from kagome::storage::face::ReadableStorage< KView, V >
using Key = KView
 
using Value = V
 
- Public Types inherited from kagome::storage::face::ReadableBase< KView >
using Key = KView
 

Detailed Description

Definition at line 15 of file trie_storage_backend_impl.hpp.

Constructor & Destructor Documentation

kagome::storage::trie::TrieStorageBackendImpl::TrieStorageBackendImpl ( std::shared_ptr< BufferStorage storage,
common::Buffer  node_prefix 
)

Definition at line 14 of file trie_storage_backend_impl.cpp.

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

Member Function Documentation

std::unique_ptr< face::WriteBatch< BufferView, Buffer > > kagome::storage::trie::TrieStorageBackendImpl::batch ( )
overridevirtual

Creates new Write Batch - an object, which can be used to efficiently write bulk data.

Implements kagome::storage::face::BatchWriteable< KView, V >.

Definition at line 27 of file trie_storage_backend_impl.cpp.

outcome::result< bool > kagome::storage::trie::TrieStorageBackendImpl::contains ( const BufferView key) const
override

Definition at line 42 of file trie_storage_backend_impl.cpp.

std::unique_ptr< TrieStorageBackendImpl::Cursor > kagome::storage::trie::TrieStorageBackendImpl::cursor ( )
overridevirtual

Returns new key-value iterator.

Returns
kv iterator

Implements kagome::storage::face::Iterable< K, V, KView >.

Definition at line 21 of file trie_storage_backend_impl.cpp.

bool kagome::storage::trie::TrieStorageBackendImpl::empty ( ) const
overridevirtual

Returns true if the storage is empty.

Implements kagome::storage::face::ReadableBase< KView >.

Definition at line 47 of file trie_storage_backend_impl.cpp.

outcome::result< Buffer > kagome::storage::trie::TrieStorageBackendImpl::load ( const BufferView key) const
override

Definition at line 32 of file trie_storage_backend_impl.cpp.

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

Definition at line 65 of file trie_storage_backend_impl.cpp.

outcome::result< void > kagome::storage::trie::TrieStorageBackendImpl::put ( const BufferView key,
const Buffer value 
)
override

Definition at line 51 of file trie_storage_backend_impl.cpp.

outcome::result< void > kagome::storage::trie::TrieStorageBackendImpl::put ( const BufferView key,
Buffer &&  value 
)
override

Definition at line 56 of file trie_storage_backend_impl.cpp.

outcome::result< void > kagome::storage::trie::TrieStorageBackendImpl::remove ( const common::BufferView key)
override

Definition at line 61 of file trie_storage_backend_impl.cpp.

size_t kagome::storage::trie::TrieStorageBackendImpl::size ( ) const
overridevirtual

Reports RAM state size

Returns
size in bytes

Implements kagome::storage::face::GenericStorage< K, V, KView >.

Definition at line 70 of file trie_storage_backend_impl.cpp.

outcome::result< std::optional< Buffer > > kagome::storage::trie::TrieStorageBackendImpl::tryLoad ( const BufferView key) const
override

Definition at line 37 of file trie_storage_backend_impl.cpp.

Member Data Documentation

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

Definition at line 42 of file trie_storage_backend_impl.hpp.

std::shared_ptr<BufferStorage> kagome::storage::trie::TrieStorageBackendImpl::storage_
private

Definition at line 41 of file trie_storage_backend_impl.hpp.


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