vm

package
v0.0.0-...-d9e9996 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, driver NewInstanceCreatorFunc)

Register makes a wasm driver available by the provided name

Types

type ContractCodeProvider

type ContractCodeProvider interface {
	GetContractCodeDesc(name string) (*pb.WasmCodeDesc, error)
	GetContractCode(name string) ([]byte, error)
}

ContractCodeProvider provides source code and desc of contract

type Instance

type Instance interface {
	Exec(function string) error
	ResourceUsed() contract.Limits
	Release()
}

Instance is a wasm virtual machine instance which can run a single contract call

type InstanceCreator

type InstanceCreator interface {
	// CreateInstance instances a wasm virtual machine instance which can run a single contract call
	CreateInstance(ctx *bridge.Context, cp ContractCodeProvider) (Instance, error)
	RemoveCache(name string)
}

InstanceCreator is the creator of wasm virtual machine instance

func Open

func Open(name string, config *InstanceCreatorConfig) (InstanceCreator, error)

Open opens a wasm virtual machine specified by its driver name

type InstanceCreatorConfig

type InstanceCreatorConfig struct {
	Basedir        string
	SyscallService *bridge.SyscallService
	// VMConfig is the config of vm driver
	VMConfig    interface{}
	DebugLogger *log.Logger
}

InstanceCreatorConfig configures InstanceCreator

type NewInstanceCreatorFunc

type NewInstanceCreatorFunc func(config *InstanceCreatorConfig) (InstanceCreator, error)

NewInstanceCreatorFunc instances a new InstanceCreator from InstanceCreatorConfig

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL