wasmtime

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotLinked           = errors.New("not linked")
	ErrAlreadyInstantiated = errors.New("already instantiated")
	ErrNotInstantiated     = errors.New("not instantiated")
	ErrAlreadyLinked       = errors.New("already linked")
)

Functions

This section is empty.

Types

type ABILinker added in v1.0.0

type ABILinker interface {
	LinkABI(Import) error
}

type ExportFuncs

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

func NewExportFuncs added in v1.0.0

func NewExportFuncs(ctx context.Context, rt *Runtime) (*ExportFuncs, error)

func (*ExportFuncs) Abort added in v1.1.0

func (ef *ExportFuncs) Abort(msgPtr int32, fileNamePtr int32, line int32, col int32)

Abort is reserved for imported func env.abort() which is auto-generated by assemblyScript

func (*ExportFuncs) ApiCall added in v1.4.2

func (ef *ExportFuncs) ApiCall(kAddr, kSize, vmAddrPtr, vmSizePtr int32) int32

func (*ExportFuncs) CallContract

func (ef *ExportFuncs) CallContract(chainID int32, offset, size int32, vmAddrPtr, vmSizePtr int32) int32

func (*ExportFuncs) GetDB

func (ef *ExportFuncs) GetDB(kAddr, kSize int32, vmAddrPtr, vmSizePtr int32) int32

func (*ExportFuncs) GetData

func (ef *ExportFuncs) GetData(rid, vmAddrPtr, vmSizePtr int32) int32

func (*ExportFuncs) GetEnv added in v1.0.0

func (ef *ExportFuncs) GetEnv(kAddr, kSize int32, vmAddrPtr, vmSizePtr int32) int32

func (*ExportFuncs) GetEventType added in v1.1.0

func (ef *ExportFuncs) GetEventType(rid, vmAddrPtr, vmSizePtr int32) int32

func (*ExportFuncs) GetSQLDB added in v1.0.0

func (ef *ExportFuncs) GetSQLDB(addr, size int32, vmAddrPtr, vmSizePtr int32) int32

func (*ExportFuncs) LinkABI added in v1.0.0

func (ef *ExportFuncs) LinkABI(impt Import) error

func (*ExportFuncs) Log

func (ef *ExportFuncs) Log(logLevel, ptr, size int32) int32

func (*ExportFuncs) Seed added in v1.1.0

func (ef *ExportFuncs) Seed() float64

Seed is reserved for imported func env.seed() which is auto-generated by assemblyScript

func (*ExportFuncs) SendMqttMsg added in v1.1.0

func (ef *ExportFuncs) SendMqttMsg(topicAddr, topicSize, msgAddr, msgSize int32) int32

func (*ExportFuncs) SendTX

func (ef *ExportFuncs) SendTX(chainID int32, offset, size, vmAddrPtr, vmSizePtr int32) int32

TODO: make sendTX async, and add callback if possible

func (*ExportFuncs) SendTXWithOperator added in v1.1.0

func (ef *ExportFuncs) SendTXWithOperator(chainID int32, offset, size, vmAddrPtr, vmSizePtr int32) int32

func (*ExportFuncs) SetDB

func (ef *ExportFuncs) SetDB(kAddr, kSize, vAddr, vSize int32) int32

func (*ExportFuncs) SetData

func (ef *ExportFuncs) SetData(rid, addr, size int32) int32

TODO SetData if rid not exist, should be assigned by wasm?

func (*ExportFuncs) SetSQLDB added in v1.0.0

func (ef *ExportFuncs) SetSQLDB(addr, size int32) int32

func (*ExportFuncs) StatSubmit added in v1.4.1

func (ef *ExportFuncs) StatSubmit(vmAddrPtr, vmSizePtr int32) int32

func (*ExportFuncs) Trace added in v1.1.0

func (ef *ExportFuncs) Trace(msgPtr int32, _ int32, arr ...float64)

Trace is reserved for imported func env.trace() which is auto-generated by assemblyScript

type Import added in v1.0.0

type Import func(module, name string, f interface{}) error

type Instance

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

func NewInstanceByCode

func NewInstanceByCode(ctx context.Context, id types.SFID, code []byte, st enums.InstanceState) (i *Instance, err error)

func (*Instance) AddResource

func (i *Instance) AddResource(ctx context.Context, eventType, data []byte) uint32

func (*Instance) GetResource

func (i *Instance) GetResource(id uint32) ([]byte, bool)

func (*Instance) HandleEvent

func (i *Instance) HandleEvent(ctx context.Context, fn, eventType string, data []byte) *wasm.EventHandleResult

func (*Instance) ID

func (i *Instance) ID() string

func (*Instance) RmvResource

func (i *Instance) RmvResource(ctx context.Context, id uint32)

func (*Instance) Start

func (i *Instance) Start(ctx context.Context) error

func (*Instance) State

func (i *Instance) State() wasm.InstanceState

func (*Instance) Stop

func (i *Instance) Stop(ctx context.Context) error

type Runtime added in v1.0.0

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

func NewRuntime added in v1.0.0

func NewRuntime() *Runtime

func (*Runtime) Call added in v1.0.0

func (rt *Runtime) Call(name string, args ...interface{}) (interface{}, error)

func (*Runtime) Copy added in v1.0.0

func (rt *Runtime) Copy(hostData []byte, vmAddrPtr, vmSizePtr int32) error

func (*Runtime) Deinstantiate added in v1.1.0

func (rt *Runtime) Deinstantiate()

func (*Runtime) Instantiate added in v1.1.0

func (rt *Runtime) Instantiate() error
func (rt *Runtime) Link(lk ABILinker, code []byte) error

func (*Runtime) Read added in v1.0.0

func (rt *Runtime) Read(addr, size int32) ([]byte, error)

type Task

type Task struct {
	EventID   string
	EventType string
	Handler   string
	Payload   []byte
	// contains filtered or unexported fields
}

func (*Task) Handle

func (t *Task) Handle(ctx context.Context)

Jump to

Keyboard shortcuts

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