vm

package
v0.0.0-...-a048d37 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: Apache-2.0 Imports: 11 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 CodeHandle

type CodeHandle interface {
	GetExecCode(name string) (*ContractCode, error)
	RemoveCode(name string)
}

type CodeManager

type CodeManager struct {
	// contains filtered or unexported fields
}

func NewCodeManager

func NewCodeManager(makeExec makeExecCodeFunc) *CodeManager

func (*CodeManager) GetExecCode

func (c *CodeManager) GetExecCode(name string) (*ContractCode, error)

func (*CodeManager) RemoveCode

func (c *CodeManager) RemoveCode(name string)

type ContractCode

type ContractCode struct {
	ContractName string
	ExecCode     exec.WasmExec
}

type InstanceCreator

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

InstanceCreator is the creator of wasm virtual machine instance

func Open

func Open(name string, syscallService *bridge.SyscallService, db db.Database) (InstanceCreator, error)

Open opens a wasm virtual machine specified by its driver name

type NewInstanceCreatorFunc

type NewInstanceCreatorFunc func(syscallService *bridge.SyscallService, db db.Database) (InstanceCreator, error)

NewInstanceCreatorFunc instances a new InstanceCreator from InstanceCreatorConfig

type VMManager

type VMManager struct {
	// contains filtered or unexported fields
}

VMManager manages wasm contracts, include deploy contracts, instance wasm virtual machine, etc...

func NewVMManager

func NewVMManager(db db.Database, bridge *bridge.Bridge) *VMManager

New instances a new VMManager

func (*VMManager) DeployContract

func (v *VMManager) DeployContract(args map[string][]byte) (*pb.Response, gas.Limits, error)

DeployContract deploy contract and initialize contract

func (*VMManager) InvokeContract

func (v *VMManager) InvokeContract(method string, args map[string][]byte) (*pb.Response, gas.Limits, error)

func (*VMManager) NewCreatorInstance

func (v *VMManager) NewCreatorInstance(ctx *bridge.ContractState) (bridge.Instance, error)

NewInstance implements bridge.Executor

func (*VMManager) RegisterSyscallService

func (v *VMManager) RegisterSyscallService(syscall *bridge.SyscallService)

RegisterSyscallService implements bridge.Executor

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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