wasmproc

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0, BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ViewCopyAllState = "copy_all_state"

Variables

View Source
var GoWasmVM wasmhost.WasmVM
View Source
var TestMode = false

Functions

func GetArrayObjectId

func GetArrayObjectId(arrayObj WaspObject, index int32, typeId int32, factory ObjFactory) int32

func GetMapObjectId

func GetMapObjectId(mapObj WaspObject, keyId int32, typeId int32, factories ObjFactories) int32

func GetProcessor

func GetProcessor(binaryCode []byte, logger *logger.Logger) (coretypes.Processor, error)

func NewScViewState

func NewScViewState(ctxView coretypes.SandboxView) kv.KVStore

func NewWasmProcessor

func NewWasmProcessor(vm wasmhost.WasmVM, logger *logger.Logger) (*wasmProcessor, error)

NewWasmProcessor creates new wasm processor.

Types

type BytesDecoder

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

func NewBytesDecoder

func NewBytesDecoder(data []byte) *BytesDecoder

func (*BytesDecoder) Bytes

func (d *BytesDecoder) Bytes() []byte

func (*BytesDecoder) Int64

func (d *BytesDecoder) Int64() int64

type BytesEncoder

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

func NewBytesEncoder

func NewBytesEncoder() *BytesEncoder

func (*BytesEncoder) Bytes

func (e *BytesEncoder) Bytes(value []byte) *BytesEncoder

func (*BytesEncoder) Data

func (e *BytesEncoder) Data() []byte

func (*BytesEncoder) Int64

func (e *BytesEncoder) Int64(value int64) *BytesEncoder

type ObjFactories

type ObjFactories map[int32]ObjFactory

type ObjFactory

type ObjFactory func() WaspObject

type ScContext

type ScContext struct {
	ScSandboxObject
}

func NewScContext

func NewScContext(vm *wasmProcessor) *ScContext

func (*ScContext) Exists

func (o *ScContext) Exists(keyId int32, typeId int32) bool

func (*ScContext) GetBytes

func (o *ScContext) GetBytes(keyId int32, typeId int32) []byte

func (*ScContext) GetObjectId

func (o *ScContext) GetObjectId(keyId int32, typeId int32) int32

func (*ScContext) GetTypeId

func (o *ScContext) GetTypeId(keyId int32) int32

func (*ScContext) SetBytes

func (o *ScContext) SetBytes(keyId int32, typeId int32, bytes []byte)

type ScDict

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

func NewScBalances

func NewScBalances(vm *wasmProcessor, incoming bool) *ScDict

func NewScDict

func NewScDict(vm *wasmProcessor) *ScDict

func NewScDictFromKvStore

func NewScDictFromKvStore(host *wasmhost.KvStoreHost, kvStore kv.KVStore) *ScDict

func (*ScDict) Exists

func (o *ScDict) Exists(keyId int32, typeId int32) bool

func (*ScDict) FindOrMakeObjectId

func (o *ScDict) FindOrMakeObjectId(keyId int32, factory ObjFactory) int32

func (*ScDict) GetBytes

func (o *ScDict) GetBytes(keyId int32, typeId int32) []byte

func (*ScDict) GetObjectId

func (o *ScDict) GetObjectId(keyId int32, typeId int32) int32

func (*ScDict) GetTypeId

func (o *ScDict) GetTypeId(keyId int32) int32

func (*ScDict) InitObj

func (o *ScDict) InitObj(id int32, keyId int32, owner *ScDict)

func (*ScDict) Int64Bytes

func (o *ScDict) Int64Bytes(value int64) []byte

func (*ScDict) MustInt64

func (o *ScDict) MustInt64(bytes []byte) int64

func (*ScDict) NestedKey

func (o *ScDict) NestedKey() string

func (*ScDict) Owner

func (o *ScDict) Owner() WaspObject

func (*ScDict) Panic

func (o *ScDict) Panic(format string, args ...interface{})

func (*ScDict) SetBytes

func (o *ScDict) SetBytes(keyId int32, typeId int32, bytes []byte)

func (*ScDict) Suffix

func (o *ScDict) Suffix(keyId int32) string

func (*ScDict) Trace

func (o *ScDict) Trace(format string, a ...interface{})

type ScExports

type ScExports struct {
	ScSandboxObject
}

func NewScExports

func NewScExports(vm *wasmProcessor) *ScExports

func (*ScExports) SetBytes

func (o *ScExports) SetBytes(keyId int32, typeId int32, bytes []byte)

type ScMaps

type ScMaps struct {
	ScSandboxObject
}

func NewScMaps

func NewScMaps(vm *wasmProcessor) *ScMaps

func (*ScMaps) GetObjectId

func (a *ScMaps) GetObjectId(keyId int32, typeId int32) int32

type ScSandboxObject

type ScSandboxObject struct {
	ScDict
	// contains filtered or unexported fields
}

func (*ScSandboxObject) GetBytes

func (o *ScSandboxObject) GetBytes(keyId int32, typeId int32) []byte

func (*ScSandboxObject) GetObjectId

func (o *ScSandboxObject) GetObjectId(keyId int32, typeId int32) int32

func (*ScSandboxObject) SetBytes

func (o *ScSandboxObject) SetBytes(keyId int32, typeId int32, bytes []byte)

type ScTransferInfo

type ScTransferInfo struct {
	ScSandboxObject
	// contains filtered or unexported fields
}

func NewScTransferInfo

func NewScTransferInfo(vm *wasmProcessor) *ScTransferInfo

func (*ScTransferInfo) Invoke

func (o *ScTransferInfo) Invoke(balances int32)

func (*ScTransferInfo) SetBytes

func (o *ScTransferInfo) SetBytes(keyId int32, typeId int32, bytes []byte)

type ScTransfers

type ScTransfers struct {
	ScSandboxObject
}

func NewScTransfers

func NewScTransfers(vm *wasmProcessor) *ScTransfers

func (*ScTransfers) GetObjectId

func (a *ScTransfers) GetObjectId(keyId int32, typeId int32) int32

type ScUtility

type ScUtility struct {
	ScSandboxObject
	// contains filtered or unexported fields
}

func NewScUtility

func NewScUtility(vm *wasmProcessor) *ScUtility

func (*ScUtility) Exists

func (o *ScUtility) Exists(keyId int32, typeId int32) bool

func (*ScUtility) GetBytes

func (o *ScUtility) GetBytes(keyId int32, typeId int32) []byte

func (*ScUtility) GetTypeId

func (o *ScUtility) GetTypeId(keyId int32) int32

func (*ScUtility) InitObj

func (o *ScUtility) InitObj(id int32, keyId int32, owner *ScDict)

func (*ScUtility) SetBytes

func (o *ScUtility) SetBytes(keyId int32, typeId int32, bytes []byte)

type ScViewState

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

Wraps immutable view state into a mutable KVStore with the KVStoreWriter functions implemented as panics WaspLib already takes care of the immutability aspect, so these panics should never trigger and we can avoid a much more drastic refactoring for now

func (ScViewState) Del

func (s ScViewState) Del(key kv.Key)

func (ScViewState) Get

func (s ScViewState) Get(key kv.Key) ([]byte, error)

func (ScViewState) Has

func (s ScViewState) Has(key kv.Key) (bool, error)

func (ScViewState) Iterate

func (s ScViewState) Iterate(prefix kv.Key, f func(key kv.Key, value []byte) bool) error

func (ScViewState) IterateKeys

func (s ScViewState) IterateKeys(prefix kv.Key, f func(key kv.Key) bool) error

func (ScViewState) MustGet

func (s ScViewState) MustGet(key kv.Key) []byte

func (ScViewState) MustHas

func (s ScViewState) MustHas(key kv.Key) bool

func (ScViewState) MustIterate

func (s ScViewState) MustIterate(prefix kv.Key, f func(key kv.Key, value []byte) bool)

func (ScViewState) MustIterateKeys

func (s ScViewState) MustIterateKeys(prefix kv.Key, f func(key kv.Key) bool)

func (ScViewState) Set

func (s ScViewState) Set(key kv.Key, value []byte)

type WaspObject

type WaspObject interface {
	wasmhost.HostObject
	InitObj(id int32, keyId int32, owner *ScDict)
	Panic(format string, args ...interface{})
	FindOrMakeObjectId(keyId int32, factory ObjFactory) int32
	NestedKey() string
	Suffix(keyId int32) string
}

func NewNullObject

func NewNullObject(host *wasmhost.KvStoreHost) WaspObject

Jump to

Keyboard shortcuts

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