Kagome
Polkadot Runtime Engine in C++17
kagome::runtime::Executor Class Reference

#include <executor.hpp>

Inheritance diagram for kagome::runtime::Executor:
Collaboration diagram for kagome::runtime::Executor:

Public Types

using Buffer = common::Buffer
 
- Public Types inherited from kagome::runtime::RawExecutor
using Buffer = common::Buffer
 
using BlockHash = primitives::BlockHash
 

Public Member Functions

 Executor (std::shared_ptr< RuntimeEnvironmentFactory > env_factory, std::shared_ptr< RuntimePropertiesCache > cache)
 
template<typename Result , typename... Args>
outcome::result< PersistentResult< Result > > persistentCallAt (primitives::BlockInfo const &block_info, storage::trie::RootHash const &storage_state, std::string_view name, Args &&...args)
 
template<typename Result , typename... Args>
outcome::result< PersistentResult< Result > > persistentCallAtGenesis (std::string_view name, Args &&...args)
 
template<typename Result , typename... Args>
outcome::result< PersistentResult< Result > > persistentCallAt (primitives::BlockHash const &block_hash, std::string_view name, Args &&...args)
 
template<typename Result , typename... Args>
outcome::result< Result > callAt (primitives::BlockInfo const &block_info, storage::trie::RootHash const &storage_state, std::string_view name, Args &&...args)
 
template<typename Result , typename... Args>
outcome::result< Result > callAt (primitives::BlockHash const &block_hash, std::string_view name, Args &&...args)
 
template<typename Result , typename... Args>
outcome::result< Result > callAtGenesis (std::string_view name, Args &&...args)
 
outcome::result< common::BuffercallAtRaw (const primitives::BlockHash &block_hash, std::string_view name, const common::Buffer &encoded_args) override
 
- Public Member Functions inherited from kagome::runtime::RawExecutor
virtual ~RawExecutor ()=default
 

Private Member Functions

template<typename Result , typename... Args>
outcome::result< Result > callMediateInternal (RuntimeEnvironment &env, std::string_view name, Args &&...args)
 
template<typename Result , typename... Args>
outcome::result< Result > callInternal (RuntimeEnvironment &env, std::string_view name, Args &&...args)
 
outcome::result< storage::trie::RootHashcommitState (const RuntimeEnvironment &env)
 

Private Attributes

std::shared_ptr< RuntimeEnvironmentFactoryenv_factory_
 
std::shared_ptr< RuntimePropertiesCachecache_
 
log::Logger logger_
 

Detailed Description

The Runtime executor Provides access to the Runtime API methods, which can be called by their names with the required environment

Definition at line 47 of file executor.hpp.

Member Typedef Documentation

Definition at line 49 of file executor.hpp.

Constructor & Destructor Documentation

kagome::runtime::Executor::Executor ( std::shared_ptr< RuntimeEnvironmentFactory env_factory,
std::shared_ptr< RuntimePropertiesCache cache 
)
inline

Definition at line 51 of file executor.hpp.

Member Function Documentation

template<typename Result , typename... Args>
outcome::result<Result> kagome::runtime::Executor::callAt ( primitives::BlockInfo const &  block_info,
storage::trie::RootHash const &  storage_state,
std::string_view  name,
Args &&...  args 
)
inline

Call a runtime method in an ephemeral environment, e. g. the storage changes, made by this call, will NOT persist in the node's Trie storage The call will be done with the runtime code from

Parameters
block_infostate on
storage_statestorage state

Definition at line 142 of file executor.hpp.

template<typename Result , typename... Args>
outcome::result<Result> kagome::runtime::Executor::callAt ( primitives::BlockHash const &  block_hash,
std::string_view  name,
Args &&...  args 
)
inline

Call a runtime method in an ephemeral environment, e. g. the storage changes, made by this call, will NOT persist in the node's Trie storage The call will be done on the

Parameters
block_hashstate

Definition at line 157 of file executor.hpp.

template<typename Result , typename... Args>
outcome::result<Result> kagome::runtime::Executor::callAtGenesis ( std::string_view  name,
Args &&...  args 
)
inline

Call a runtime method in an ephemeral environment, e. g. the storage changes, made by this call, will NOT persist in the node's Trie storage The call will be done on the genesis state

Definition at line 172 of file executor.hpp.

outcome::result<common::Buffer> kagome::runtime::Executor::callAtRaw ( const primitives::BlockHash block_hash,
std::string_view  name,
const common::Buffer encoded_args 
)
inlineoverridevirtual

Call a runtime method

Parameters
nameat state on block
block_hashin an ephemeral environment, e. g. the storage changes, made by this call, will NOT persist in the node's Trie storage The call will be done with the runtime code from
block_infostate Arguments for the call are expected to be scale-encoded into single buffer
encoded_argsbeforehand
Returns
scale-encoded result

Implements kagome::runtime::RawExecutor.

Definition at line 180 of file executor.hpp.

template<typename Result , typename... Args>
outcome::result<Result> kagome::runtime::Executor::callInternal ( RuntimeEnvironment env,
std::string_view  name,
Args &&...  args 
)
inlineprivate

Internal method for calling a Runtime API method Resets the runtime memory with the module's heap base, encodes the arguments with SCALE codec, calls the method from the provided module instance and returns a result, decoded from SCALE. Changes, made to the Host API state, are reset after the call.

Definition at line 242 of file executor.hpp.

template<typename Result , typename... Args>
outcome::result<Result> kagome::runtime::Executor::callMediateInternal ( RuntimeEnvironment env,
std::string_view  name,
Args &&...  args 
)
inlineprivate

Internal method for calling a Runtime API method Resets the runtime memory with the module's heap base, encodes the arguments with SCALE codec, calls the method from the provided module instance and returns a result, decoded from SCALE. Changes, made to the Host API state, are reset after the call.

Definition at line 212 of file executor.hpp.

outcome::result<storage::trie::RootHash> kagome::runtime::Executor::commitState ( const RuntimeEnvironment env)
inlineprivate

Definition at line 286 of file executor.hpp.

template<typename Result , typename... Args>
outcome::result<PersistentResult<Result> > kagome::runtime::Executor::persistentCallAt ( primitives::BlockInfo const &  block_info,
storage::trie::RootHash const &  storage_state,
std::string_view  name,
Args &&...  args 
)
inline

Call a runtime method in a persistent environment, e. g. the storage changes, made by this call, will persist in the node's Trie storage The call will be done with the runtime code from

Parameters
block_infostate on
storage_statestorage state

Definition at line 66 of file executor.hpp.

template<typename Result , typename... Args>
outcome::result<PersistentResult<Result> > kagome::runtime::Executor::persistentCallAt ( primitives::BlockHash const &  block_hash,
std::string_view  name,
Args &&...  args 
)
inline

Call a runtime method in a persistent environment, e. g. the storage changes, made by this call, will persist in the node's Trie storage The call will be done on the

Parameters
block_infostate

Definition at line 116 of file executor.hpp.

template<typename Result , typename... Args>
outcome::result<PersistentResult<Result> > kagome::runtime::Executor::persistentCallAtGenesis ( std::string_view  name,
Args &&...  args 
)
inline

Call a runtime method in a persistent environment, e. g. the storage changes, made by this call, will persist in the node's Trie storage The call will be done on the genesis block state

Definition at line 93 of file executor.hpp.

Member Data Documentation

std::shared_ptr<RuntimePropertiesCache> kagome::runtime::Executor::cache_
private

Definition at line 303 of file executor.hpp.

std::shared_ptr<RuntimeEnvironmentFactory> kagome::runtime::Executor::env_factory_
private

Definition at line 302 of file executor.hpp.

log::Logger kagome::runtime::Executor::logger_
private

Definition at line 304 of file executor.hpp.


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