Kagome
Polkadot Runtime Engine in C++17
module_factory_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_RUNTIME_WAVM_MODULE_FACTORY_IMPL_HPP
7 #define KAGOME_CORE_RUNTIME_WAVM_MODULE_FACTORY_IMPL_HPP
8 
10 
11 #include "outcome/outcome.hpp"
12 
13 namespace kagome::application {
14  class AppConfiguration;
15 }
16 namespace kagome::crypto {
17  class Hasher;
18 }
19 
20 namespace kagome::runtime::wavm {
21 
22  class CompartmentWrapper;
23  class InstanceEnvironmentFactory;
24  class IntrinsicModule;
25  struct ModuleParams;
26  struct ModuleCache;
27 
28  class ModuleFactoryImpl final : public ModuleFactory {
29  public:
31  std::shared_ptr<CompartmentWrapper> compartment,
32  std::shared_ptr<ModuleParams> module_params,
33  std::shared_ptr<const InstanceEnvironmentFactory> env_factory,
34  std::shared_ptr<IntrinsicModule> intrinsic_module,
35  std::optional<std::shared_ptr<ModuleCache>> module_cache,
36  std::shared_ptr<crypto::Hasher> hasher);
37 
38  outcome::result<std::unique_ptr<Module>> make(
39  gsl::span<const uint8_t> code) const override;
40 
41  private:
42  std::shared_ptr<CompartmentWrapper> compartment_;
43  std::shared_ptr<ModuleParams> module_params_;
44  std::shared_ptr<const InstanceEnvironmentFactory> env_factory_;
45  std::shared_ptr<IntrinsicModule> intrinsic_module_;
46  std::shared_ptr<crypto::Hasher> hasher_;
47  };
48 
49 } // namespace kagome::runtime::wavm
50 
51 #endif // KAGOME_CORE_RUNTIME_WAVM_MODULE_FACTORY_IMPL_HPP
std::shared_ptr< ModuleParams > module_params_
std::shared_ptr< CompartmentWrapper > compartment_
std::shared_ptr< IntrinsicModule > intrinsic_module_
std::shared_ptr< crypto::Hasher > hasher_
std::shared_ptr< const InstanceEnvironmentFactory > env_factory_