Kagome
Polkadot Runtime Engine in C++17
kagome::offchain::OffchainPersistentStorageImpl Class Referencefinal

#include <offchain_persistent_storage.hpp>

Inheritance diagram for kagome::offchain::OffchainPersistentStorageImpl:
Collaboration diagram for kagome::offchain::OffchainPersistentStorageImpl:

Public Member Functions

 OffchainPersistentStorageImpl (std::shared_ptr< storage::BufferStorage > storage)
 
outcome::result< void > set (const common::BufferView &key, common::Buffer value) override
 Sets a value in the storage. More...
 
outcome::result< void > clear (const common::BufferView &key) override
 Remove a value from the local storage. More...
 
outcome::result< bool > compare_and_set (const common::BufferView &key, const std::optional< common::BufferView > &expected, common::Buffer value) override
 Sets a new value in the local storage if the condition matches the current value. More...
 
outcome::result< common::Bufferget (const common::BufferView &key) override
 Gets a value from the local storage. More...
 
- Public Member Functions inherited from kagome::offchain::OffchainStorage
virtual ~OffchainStorage ()=default
 

Private Attributes

std::shared_ptr< storage::BufferStoragestorage_
 
std::mutex mutex_
 
log::Logger log_
 

Detailed Description

Definition at line 16 of file offchain_persistent_storage.hpp.

Constructor & Destructor Documentation

kagome::offchain::OffchainPersistentStorageImpl::OffchainPersistentStorageImpl ( std::shared_ptr< storage::BufferStorage storage)
explicit

Definition at line 23 of file offchain_persistent_storage.cpp.

Member Function Documentation

outcome::result< void > kagome::offchain::OffchainPersistentStorageImpl::clear ( const common::BufferView key)
overridevirtual

Remove a value from the local storage.

Parameters
keya pointer-size indicating the key
Returns
success or error

Implements kagome::offchain::OffchainStorage.

Definition at line 37 of file offchain_persistent_storage.cpp.

outcome::result< bool > kagome::offchain::OffchainPersistentStorageImpl::compare_and_set ( const common::BufferView key,
const std::optional< common::BufferView > &  expected,
common::Buffer  value 
)
overridevirtual

Sets a new value in the local storage if the condition matches the current value.

Parameters
keya pointer-size indicating the key
expecteda pointer-size indicating the old value
valuea pointer-size indicating the new value
Returns
bool as result, or error at failure

Implements kagome::offchain::OffchainStorage.

Definition at line 44 of file offchain_persistent_storage.cpp.

outcome::result< common::Buffer > kagome::offchain::OffchainPersistentStorageImpl::get ( const common::BufferView key)
overridevirtual

Gets a value from the local storage.

Parameters
keya pointer-size indicating the key
Returns
value for success, or error at failure

Implements kagome::offchain::OffchainStorage.

Definition at line 66 of file offchain_persistent_storage.cpp.

outcome::result< void > kagome::offchain::OffchainPersistentStorageImpl::set ( const common::BufferView key,
common::Buffer  value 
)
overridevirtual

Sets a value in the storage.

Parameters
keya pointer-size indicating the key
valuea pointer-size indicating the value
Returns
success or error

Implements kagome::offchain::OffchainStorage.

Definition at line 30 of file offchain_persistent_storage.cpp.

Member Data Documentation

log::Logger kagome::offchain::OffchainPersistentStorageImpl::log_
private

Definition at line 37 of file offchain_persistent_storage.hpp.

std::mutex kagome::offchain::OffchainPersistentStorageImpl::mutex_
private

Definition at line 36 of file offchain_persistent_storage.hpp.

std::shared_ptr<storage::BufferStorage> kagome::offchain::OffchainPersistentStorageImpl::storage_
private

Definition at line 34 of file offchain_persistent_storage.hpp.


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