Kagome
Polkadot Runtime Engine in C++17
kagome::runtime::ModuleInstance Class Referenceabstract

#include <module_instance.hpp>

Inheritance diagram for kagome::runtime::ModuleInstance:
Collaboration diagram for kagome::runtime::ModuleInstance:

Public Types

using SegmentOffset = size_t
 
using SegmentData = gsl::span< const uint8_t >
 
using DataSegmentProcessor = std::function< void(SegmentOffset, SegmentData)>
 

Public Member Functions

virtual ~ModuleInstance ()=default
 
virtual const common::Hash256getCodeHash () const =0
 
virtual outcome::result< PtrSizecallExportFunction (std::string_view name, common::BufferView encoded_args) const =0
 
virtual outcome::result< std::optional< WasmValue > > getGlobal (std::string_view name) const =0
 
virtual void forDataSegment (DataSegmentProcessor const &callback) const =0
 
virtual InstanceEnvironment const & getEnvironment () const =0
 
virtual outcome::result< void > resetEnvironment ()=0
 

Detailed Description

An instance of a WebAssembly code module Exposes a set of functions and global variables

Definition at line 30 of file module_instance.hpp.

Member Typedef Documentation

using kagome::runtime::ModuleInstance::SegmentData = gsl::span<const uint8_t>

Definition at line 50 of file module_instance.hpp.

Definition at line 49 of file module_instance.hpp.

Constructor & Destructor Documentation

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

Member Function Documentation

virtual outcome::result<PtrSize> kagome::runtime::ModuleInstance::callExportFunction ( std::string_view  name,
common::BufferView  encoded_args 
) const
pure virtual

Call the instance's function

Parameters
name- name of the function
args- a pointer-size describing a buffer with the function parameters
Returns
a pointer-size with the buffer returned by the call

Implemented in kagome::runtime::wavm::ModuleInstanceImpl, kagome::runtime::binaryen::ModuleInstanceImpl, and kagome::runtime::BorrowedInstance.

virtual void kagome::runtime::ModuleInstance::forDataSegment ( DataSegmentProcessor const &  callback) const
pure virtual
virtual const common::Hash256& kagome::runtime::ModuleInstance::getCodeHash ( ) const
pure virtual
virtual InstanceEnvironment const& kagome::runtime::ModuleInstance::getEnvironment ( ) const
pure virtual
virtual outcome::result<std::optional<WasmValue> > kagome::runtime::ModuleInstance::getGlobal ( std::string_view  name) const
pure virtual
virtual outcome::result<void> kagome::runtime::ModuleInstance::resetEnvironment ( )
pure virtual

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