Kagome
Polkadot Runtime Engine in C++17
kagome::offchain::OffchainStorage Class Referenceabstract

#include <offchain_storage.hpp>

Inheritance diagram for kagome::offchain::OffchainStorage:
Collaboration diagram for kagome::offchain::OffchainStorage:

Public Member Functions

virtual ~OffchainStorage ()=default
 
virtual outcome::result< void > set (const common::BufferView &key, common::Buffer value)=0
 Sets a value in the storage. More...
 
virtual outcome::result< void > clear (const common::BufferView &key)=0
 Remove a value from the local storage. More...
 
virtual outcome::result< bool > compare_and_set (const common::BufferView &key, const std::optional< common::BufferView > &expected, common::Buffer value)=0
 Sets a new value in the local storage if the condition matches the current value. More...
 
virtual outcome::result< common::Bufferget (const common::BufferView &key)=0
 Gets a value from the local storage. More...
 

Detailed Description

A wrapper for a storage of offchain data Provides a convenient interface to work with it

Definition at line 20 of file offchain_storage.hpp.

Constructor & Destructor Documentation

virtual kagome::offchain::OffchainStorage::~OffchainStorage ( )
virtualdefault

Member Function Documentation

virtual outcome::result<void> kagome::offchain::OffchainStorage::clear ( const common::BufferView key)
pure virtual

Remove a value from the local storage.

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

Implemented in kagome::offchain::OffchainLocalStorageImpl, and kagome::offchain::OffchainPersistentStorageImpl.

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

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

Implemented in kagome::offchain::OffchainLocalStorageImpl, and kagome::offchain::OffchainPersistentStorageImpl.

virtual outcome::result<common::Buffer> kagome::offchain::OffchainStorage::get ( const common::BufferView key)
pure virtual

Gets a value from the local storage.

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

Implemented in kagome::offchain::OffchainLocalStorageImpl, and kagome::offchain::OffchainPersistentStorageImpl.

virtual outcome::result<void> kagome::offchain::OffchainStorage::set ( const common::BufferView key,
common::Buffer  value 
)
pure virtual

Sets a value in the storage.

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

Implemented in kagome::offchain::OffchainLocalStorageImpl, and kagome::offchain::OffchainPersistentStorageImpl.


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