Kagome
Polkadot Runtime Engine in C++17
kagome::runtime::TrieStorageProvider Class Referenceabstract

#include <trie_storage_provider.hpp>

Inheritance diagram for kagome::runtime::TrieStorageProvider:
Collaboration diagram for kagome::runtime::TrieStorageProvider:

Public Types

using Batch = storage::trie::TrieBatch
 
using PersistentBatch = storage::trie::PersistentTrieBatch
 

Public Member Functions

virtual ~TrieStorageProvider ()=default
 
virtual outcome::result< void > setToEphemeralAt (const common::Hash256 &state_root)=0
 
virtual outcome::result< void > setToPersistentAt (const common::Hash256 &state_root)=0
 
virtual std::shared_ptr< BatchgetCurrentBatch () const =0
 
virtual std::optional< std::shared_ptr< PersistentBatch > > tryGetPersistentBatch () const =0
 
virtual bool isCurrentlyPersistent () const =0
 
virtual outcome::result< std::shared_ptr< PersistentBatch > > getChildBatchAt (const common::Buffer &root_path)=0
 Get (or create new) Child Batch with given root hash. More...
 
virtual void clearChildBatches () noexcept=0
 
virtual outcome::result< storage::trie::RootHashforceCommit ()=0
 
virtual outcome::result< void > startTransaction ()=0
 Start nested transaction. More...
 
virtual outcome::result< void > rollbackTransaction ()=0
 Rollback and finish last started transaction. More...
 
virtual outcome::result< void > commitTransaction ()=0
 Commit and finish last started transaction. More...
 

Detailed Description

Provides access to the trie storage for runtime API As some calls need an access to a temporary storage (called 'ephemeral') and some introduce changes that need to persist, TrieStorageProvider maintains a 'current batch', which can be either persistent or ephemeral, and provides it for runtime calls

Definition at line 26 of file trie_storage_provider.hpp.

Member Typedef Documentation

Constructor & Destructor Documentation

virtual kagome::runtime::TrieStorageProvider::~TrieStorageProvider ( )
virtualdefault

Member Function Documentation

virtual void kagome::runtime::TrieStorageProvider::clearChildBatches ( )
pure virtualnoexcept

Clear internal map of child storages batches

Implemented in kagome::runtime::TrieStorageProviderImpl.

virtual outcome::result<void> kagome::runtime::TrieStorageProvider::commitTransaction ( )
pure virtual

Commit and finish last started transaction.

Implemented in kagome::runtime::TrieStorageProviderImpl.

virtual outcome::result<storage::trie::RootHash> kagome::runtime::TrieStorageProvider::forceCommit ( )
pure virtual

Commits persistent changes even if the current batch is not persistent

Implemented in kagome::runtime::TrieStorageProviderImpl.

virtual outcome::result<std::shared_ptr<PersistentBatch> > kagome::runtime::TrieStorageProvider::getChildBatchAt ( const common::Buffer root_path)
pure virtual

Get (or create new) Child Batch with given root hash.

Parameters
rootroot hash value of a new (or cached) batch
Returns
Child storage tree batch

Implemented in kagome::runtime::TrieStorageProviderImpl.

virtual std::shared_ptr<Batch> kagome::runtime::TrieStorageProvider::getCurrentBatch ( ) const
pure virtual
Returns
current batch, if any was set (
See also
setToEphemeral, setToPersistent), null otherwise

Implemented in kagome::runtime::TrieStorageProviderImpl.

virtual bool kagome::runtime::TrieStorageProvider::isCurrentlyPersistent ( ) const
pure virtual
Returns
true, if the current batch is persistent, false otherwise

Implemented in kagome::runtime::TrieStorageProviderImpl.

virtual outcome::result<void> kagome::runtime::TrieStorageProvider::rollbackTransaction ( )
pure virtual

Rollback and finish last started transaction.

Implemented in kagome::runtime::TrieStorageProviderImpl.

virtual outcome::result<void> kagome::runtime::TrieStorageProvider::setToEphemeralAt ( const common::Hash256 state_root)
pure virtual

Sets the current batch to a new ephemeral batch

Implemented in kagome::runtime::TrieStorageProviderImpl.

virtual outcome::result<void> kagome::runtime::TrieStorageProvider::setToPersistentAt ( const common::Hash256 state_root)
pure virtual

Sets the current batch to a new persistent batch at specified storage state

Warning
this will reset storage state to th specified root and discard all changes accumulated in the current persistent batch

Implemented in kagome::runtime::TrieStorageProviderImpl.

virtual outcome::result<void> kagome::runtime::TrieStorageProvider::startTransaction ( )
pure virtual

Start nested transaction.

Implemented in kagome::runtime::TrieStorageProviderImpl.

virtual std::optional<std::shared_ptr<PersistentBatch> > kagome::runtime::TrieStorageProvider::tryGetPersistentBatch ( ) const
pure virtual
Returns
current persistent batch, if the current batch is persistent, none otherwise

Implemented in kagome::runtime::TrieStorageProviderImpl.


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