wasm

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NameVersion = "w3bstream@v0.0.1"

Functions

This section is empty.

Types

type ABI

type ABI struct {
	Imports  ImportsHandler
	Instance Instance
}

func (*ABI) Alloc

func (a *ABI) Alloc()

func (*ABI) Free

func (a *ABI) Free()

func (*ABI) GetExports

func (a *ABI) GetExports() ExportsHandler

func (*ABI) GetImports

func (a *ABI) GetImports() ImportsHandler

func (*ABI) GetInstance

func (a *ABI) GetInstance() Instance

func (*ABI) Name

func (a *ABI) Name() string

func (*ABI) SetImports

func (a *ABI) SetImports(i ImportsHandler)

func (*ABI) SetInstance

func (a *ABI) SetInstance(i Instance)

func (*ABI) Start

func (a *ABI) Start()

type ContextHandler

type ContextHandler interface {
	Name() string
	GetImports() ImportsHandler
	SetImports(ImportsHandler)
	GetExports() ExportsHandler
	GetInstance() Instance
	SetInstance(Instance)
}

type EventConsumer

type EventConsumer interface {
	HandleEvent(ctx context.Context, handler string, payload []byte) *EventHandleResult
}

type EventHandleResult

type EventHandleResult struct {
	InstanceID string           `json:"instanceID"`
	Rsp        []byte           `json:"-"`
	Code       ResultStatusCode `json:"code"`
	ErrMsg     string           `json:"errMsg"`
}

type ExportsHandler

type ExportsHandler interface {
	Start()
	Alloc()
	Free()
}

type Handler

type Handler interface {
	Name() string
	Call(context.Context, ...interface{})
}

type ImportsHandler

type ImportsHandler interface {
	GetDB(keyAddr, keySize, valAddr, valSize uint32) (code int32)
	SetDB()
	GetData()
	SetData()
	Log(level uint32)
}

type Instance

type Instance interface {
	ID() string
	Start(context.Context) error
	Stop(context.Context) error
	State() enums.InstanceState
	AddResource(context.Context, []byte) uint32
	RmvResource(context.Context, uint32)
	GetResource(uint32) ([]byte, bool)
	Get(k string) int32

	EventConsumer
}

type InstanceState

type InstanceState = enums.InstanceState

type KVStore

type KVStore interface {
	Get(string) int32
}

type Memory

type Memory interface {
	Read(context.Context, uint32, uint32) ([]byte, error)
	Write(context.Context, []byte)
}

type Module

type Module interface {
	Init()
	NewInstance() Instance
	GetABI() []string
}

type ResultStatusCode

type ResultStatusCode int32

ResultStatusCode wasm call result code

const (
	ResultStatusCode_OK ResultStatusCode = iota
	ResultStatusCode_UnexportedHandler
	ResultStatusCode_ResourceNotFound
	ResultStatusCode_ImportNotFound
	ResultStatusCode_ImportCallFailed
	ResultStatusCode_TransDataToVMFailed
	ResultStatusCode_TransDataFromVMFailed
	ResultStatusCode_HostInternal

	// TODO following result status
	ResultStatusCode_Failed = -1 // reserved for wasm invoke failed
)

type VM

type VM interface {
	Name() string
	Init()
	NewModule(code []byte) Module
}

Jump to

Keyboard shortcuts

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