Kagome
Polkadot Runtime Engine in C++17
|
#include <in_memory_storage.hpp>
Public Member Functions | |
~InMemoryStorage () override=default | |
outcome::result< common::Buffer > | load (const common::BufferView &key) const override |
outcome::result< std::optional< common::Buffer > > | tryLoad (const common::BufferView &key) const override |
outcome::result< void > | put (const common::BufferView &key, const common::Buffer &value) override |
outcome::result< void > | put (const common::BufferView &key, common::Buffer &&value) override |
outcome::result< bool > | contains (const common::BufferView &key) const override |
bool | empty () const override |
Returns true if the storage is empty. More... | |
outcome::result< void > | remove (const common::BufferView &key) override |
std::unique_ptr< kagome::storage::face::WriteBatch< common::BufferView, common::Buffer > > | batch () override |
Creates new Write Batch - an object, which can be used to efficiently write bulk data. More... | |
std::unique_ptr< storage::BufferStorage::Cursor > | cursor () override |
Returns new key-value iterator. More... | |
size_t | size () const override |
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 Attributes | |
std::map< std::string, common::Buffer > | storage |
size_t | size_ = 0 |
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 |
Simple storage that conforms PersistentMap interface Mostly needed to have an in-memory trie in tests to avoid integration with an actual persistent database
Definition at line 22 of file in_memory_storage.hpp.
|
overridedefault |
|
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 77 of file in_memory_storage.cpp.
|
override |
Definition at line 59 of file in_memory_storage.cpp.
|
overridevirtual |
Returns new key-value iterator.
Implements kagome::storage::face::Iterable< K, V, KView >.
Definition at line 81 of file in_memory_storage.cpp.
|
overridevirtual |
Returns true if the storage is empty.
Implements kagome::storage::face::ReadableBase< KView >.
Definition at line 63 of file in_memory_storage.cpp.
|
override |
Definition at line 15 of file in_memory_storage.cpp.
|
override |
Definition at line 33 of file in_memory_storage.cpp.
|
override |
Definition at line 46 of file in_memory_storage.cpp.
|
override |
Definition at line 67 of file in_memory_storage.cpp.
|
overridevirtual |
Reports RAM state size
Implements kagome::storage::face::GenericStorage< K, V, KView >.
Definition at line 85 of file in_memory_storage.cpp.
|
override |
Definition at line 24 of file in_memory_storage.cpp.
|
private |
Definition at line 55 of file in_memory_storage.hpp.
|
private |
Definition at line 54 of file in_memory_storage.hpp.