6 #ifndef KAGOME_CORE_RUNTIME_BINARYEN_RUNTIME_EXTERNAL_INTERFACE_HPP 7 #define KAGOME_CORE_RUNTIME_BINARYEN_RUNTIME_EXTERNAL_INTERFACE_HPP 9 #include <binaryen/shell-interface.h> 11 #include <boost/unordered_map.hpp> 21 class TrieStorageProvider;
23 class ExecutorFactory;
36 std::shared_ptr<host_api::HostApi> host_api);
38 wasm::Literal callImport(wasm::Function *
import,
39 wasm::LiteralList &arguments)
override;
41 wasm::ShellExternalInterface::Memory *getMemory();
43 void trap(
const char *why)
override {
44 logger_->error(
"Trap: {}", why);
45 throw wasm::TrapException{};
53 void checkArguments(std::string_view extern_name,
57 void methodsRegistration();
61 wasm::Function *
import,
62 wasm::LiteralList &arguments);
67 wasm::Function *
import,
68 wasm::LiteralList &arguments);
70 boost::unordered_map<std::string, ImportFuncPtr>
imports_;
76 #endif // KAGOME_CORE_RUNTIME_BINARYEN_RUNTIME_EXTERNAL_INTERFACE_HPP
std::shared_ptr< soralog::Logger > Logger
wasm::Literal(*)(RuntimeExternalInterface &this_, wasm::Function *import, wasm::LiteralList &arguments) ImportFuncPtr
boost::unordered_map< std::string, ImportFuncPtr > imports_
void trap(const char *why) override
std::shared_ptr< host_api::HostApi > host_api_