Kagome
Polkadot Runtime Engine in C++17
core_api_factory_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_RUNTIME_WAVM_CORE_API_PROVIDER_HPP
7 #define KAGOME_CORE_RUNTIME_WAVM_CORE_API_PROVIDER_HPP
8 
10 
11 #include <memory>
12 
13 namespace kagome::storage::trie {
14  class TrieStorage;
15 }
16 
18  class ChangesTracker;
19 }
20 
21 namespace kagome::blockchain {
22  class BlockHeaderRepository;
23 }
24 
25 namespace kagome::runtime {
26  class Memory;
27  class ModuleRepository;
28  class SingleModuleCache;
29  class RuntimePropertiesCache;
30 } // namespace kagome::runtime
31 
32 namespace kagome::runtime::wavm {
33 
34  class IntrinsicModule;
35  class CompartmentWrapper;
36  class InstanceEnvironmentFactory;
37  struct ModuleParams;
38 
39  class CoreApiFactoryImpl final
40  : public runtime::CoreApiFactory,
41  public std::enable_shared_from_this<CoreApiFactoryImpl> {
42  public:
44  std::shared_ptr<CompartmentWrapper> compartment,
45  std::shared_ptr<ModuleParams> module_params,
46  std::shared_ptr<IntrinsicModule> intrinsic_module,
47  std::shared_ptr<storage::trie::TrieStorage> storage,
48  std::shared_ptr<blockchain::BlockHeaderRepository> block_header_repo,
49  std::shared_ptr<const InstanceEnvironmentFactory> instance_env_factory,
50  std::shared_ptr<storage::changes_trie::ChangesTracker> changes_tracker,
51  std::shared_ptr<SingleModuleCache> last_compiled_module,
52  std::shared_ptr<runtime::RuntimePropertiesCache> cache);
53 
54  [[nodiscard]] std::unique_ptr<Core> make(
55  std::shared_ptr<const crypto::Hasher> hasher,
56  const std::vector<uint8_t> &runtime_code) const override;
57 
58  private:
59  std::shared_ptr<const InstanceEnvironmentFactory> instance_env_factory_;
60  std::shared_ptr<CompartmentWrapper> compartment_;
61  std::shared_ptr<ModuleParams> module_params_;
62  std::shared_ptr<IntrinsicModule> intrinsic_module_;
63  std::shared_ptr<storage::trie::TrieStorage> storage_;
64  std::shared_ptr<blockchain::BlockHeaderRepository> block_header_repo_;
65  std::shared_ptr<storage::changes_trie::ChangesTracker> changes_tracker_;
66  std::shared_ptr<SingleModuleCache> last_compiled_module_;
67  std::shared_ptr<runtime::RuntimePropertiesCache> cache_;
68  };
69 
70 } // namespace kagome::runtime::wavm
71 
72 #endif // KAGOME_CORE_RUNTIME_WAVM_CORE_API_PROVIDER_HPP
std::shared_ptr< storage::changes_trie::ChangesTracker > changes_tracker_
std::shared_ptr< ModuleParams > module_params_
std::shared_ptr< CompartmentWrapper > compartment_
std::shared_ptr< runtime::RuntimePropertiesCache > cache_
std::shared_ptr< IntrinsicModule > intrinsic_module_
std::shared_ptr< SingleModuleCache > last_compiled_module_
std::shared_ptr< storage::trie::TrieStorage > storage_
std::shared_ptr< const InstanceEnvironmentFactory > instance_env_factory_
std::shared_ptr< blockchain::BlockHeaderRepository > block_header_repo_