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

#include <runtime_environment_factory.hpp>

Inheritance diagram for kagome::runtime::RuntimeEnvironmentFactory:
Collaboration diagram for kagome::runtime::RuntimeEnvironmentFactory:

Classes

struct  RuntimeEnvironmentTemplate
 

Public Types

enum  Error { Error::PARENT_FACTORY_EXPIRED = 1, Error::ABSENT_BLOCK, Error::ABSENT_HEAP_BASE, Error::FAILED_TO_SET_STORAGE_STATE }
 

Public Member Functions

 RuntimeEnvironmentFactory (std::shared_ptr< const runtime::RuntimeCodeProvider > code_provider, std::shared_ptr< ModuleRepository > module_repo, std::shared_ptr< const blockchain::BlockHeaderRepository > header_repo)
 
virtual ~RuntimeEnvironmentFactory ()=default
 
virtual std::unique_ptr< RuntimeEnvironmentTemplatestart (const primitives::BlockInfo &blockchain_state, const storage::trie::RootHash &storage_state) const
 
virtual outcome::result< std::unique_ptr< RuntimeEnvironmentTemplate > > start (const primitives::BlockHash &blockchain_state) const
 returns a handle to make a RuntimeEnvironment at the state of the provided block More...
 
virtual outcome::result< std::unique_ptr< RuntimeEnvironmentTemplate > > start () const
 returns a handle to make a RuntimeEnvironment at genesis block state More...
 

Private Attributes

std::shared_ptr< const runtime::RuntimeCodeProvidercode_provider_
 
std::shared_ptr< ModuleRepositorymodule_repo_
 
std::shared_ptr< const blockchain::BlockHeaderRepositoryheader_repo_
 
log::Logger logger_
 

Detailed Description

Definition at line 38 of file runtime_environment_factory.hpp.

Member Enumeration Documentation

Enumerator
PARENT_FACTORY_EXPIRED 
ABSENT_BLOCK 
ABSENT_HEAP_BASE 
FAILED_TO_SET_STORAGE_STATE 

Definition at line 41 of file runtime_environment_factory.hpp.

Constructor & Destructor Documentation

kagome::runtime::RuntimeEnvironmentFactory::RuntimeEnvironmentFactory ( std::shared_ptr< const runtime::RuntimeCodeProvider code_provider,
std::shared_ptr< ModuleRepository module_repo,
std::shared_ptr< const blockchain::BlockHeaderRepository header_repo 
)

Definition at line 161 of file runtime_environment_factory.cpp.

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

Member Function Documentation

std::unique_ptr< RuntimeEnvironmentFactory::RuntimeEnvironmentTemplate > kagome::runtime::RuntimeEnvironmentFactory::start ( const primitives::BlockInfo blockchain_state,
const storage::trie::RootHash storage_state 
) const
virtual
Parameters
blockchain_state- the block to take the runtime code from
storage_stateneed to store separately from blockchain state because, for example, when we're in process of producing a block, there is no particular storage state associated with the block
Returns
a RuntimeEnvironmentTemplate which can be used to configure and produce a RuntimeEnvironment

Definition at line 175 of file runtime_environment_factory.cpp.

outcome::result< std::unique_ptr< RuntimeEnvironmentFactory::RuntimeEnvironmentTemplate > > kagome::runtime::RuntimeEnvironmentFactory::start ( const primitives::BlockHash blockchain_state) const
virtual

returns a handle to make a RuntimeEnvironment at the state of the provided block

Parameters
blockchain_state- the block to take the runtime code from
Returns
a RuntimeEnvironmentTemplate which can be used to configure and produce a RuntimeEnvironment

Definition at line 184 of file runtime_environment_factory.cpp.

outcome::result< std::unique_ptr< RuntimeEnvironmentFactory::RuntimeEnvironmentTemplate > > kagome::runtime::RuntimeEnvironmentFactory::start ( ) const
virtual

returns a handle to make a RuntimeEnvironment at genesis block state

Returns
a RuntimeEnvironmentTemplate which can be used to configure and produce a RuntimeEnvironment

Definition at line 193 of file runtime_environment_factory.cpp.

Member Data Documentation

std::shared_ptr<const runtime::RuntimeCodeProvider> kagome::runtime::RuntimeEnvironmentFactory::code_provider_
private

Definition at line 92 of file runtime_environment_factory.hpp.

std::shared_ptr<const blockchain::BlockHeaderRepository> kagome::runtime::RuntimeEnvironmentFactory::header_repo_
private

Definition at line 94 of file runtime_environment_factory.hpp.

log::Logger kagome::runtime::RuntimeEnvironmentFactory::logger_
private

Definition at line 95 of file runtime_environment_factory.hpp.

std::shared_ptr<ModuleRepository> kagome::runtime::RuntimeEnvironmentFactory::module_repo_
private

Definition at line 93 of file runtime_environment_factory.hpp.


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