Documentation
¶
Index ¶
- Constants
- Variables
- func GetArrayObjectID(arrayObj WaspObject, index, typeID int32, factory ObjFactory) int32
- func GetMapObjectID(mapObj WaspObject, keyID, typeID int32, factories ObjFactories) int32
- func GetProcessor(binaryCode []byte, log *logger.Logger) (iscp.VMProcessor, error)
- func NewScViewState(ctxView iscp.SandboxView) kv.KVStore
- type BytesDecoder
- type BytesEncoder
- type ObjFactories
- type ObjFactory
- type ScContext
- type ScDict
- func (o *ScDict) CallFunc(keyID int32, params []byte) []byte
- func (o *ScDict) Exists(keyID, typeID int32) bool
- func (o *ScDict) FindOrMakeObjectID(keyID int32, factory ObjFactory) int32
- func (o *ScDict) GetBytes(keyID, typeID int32) []byte
- func (o *ScDict) GetObjectID(keyID, typeID int32) int32
- func (o *ScDict) GetTypeID(keyID int32) int32
- func (o *ScDict) InitObj(id, keyID int32, owner *ScDict)
- func (o *ScDict) InvalidKey(keyID int32)
- func (o *ScDict) KvStore() kv.KVStore
- func (o *ScDict) NestedKey() string
- func (o *ScDict) Owner() WaspObject
- func (o *ScDict) Panic(format string, args ...interface{})
- func (o *ScDict) SetBytes(keyID, typeID int32, bytes []byte)
- func (o *ScDict) SetKvStore(res kv.KVStore)
- func (o *ScDict) Suffix(keyID int32) string
- func (o *ScDict) Tracef(format string, a ...interface{})
- type ScExports
- type ScMaps
- type ScSandboxObject
- type ScTransferInfo
- type ScTransfers
- type ScUtility
- type ScViewState
- func (s ScViewState) Del(key kv.Key)
- func (s ScViewState) Get(key kv.Key) ([]byte, error)
- func (s ScViewState) Has(key kv.Key) (bool, error)
- func (s ScViewState) Iterate(prefix kv.Key, f func(key kv.Key, value []byte) bool) error
- func (s ScViewState) IterateKeys(prefix kv.Key, f func(key kv.Key) bool) error
- func (s ScViewState) IterateKeysSorted(prefix kv.Key, f func(key kv.Key) bool) error
- func (s ScViewState) IterateSorted(prefix kv.Key, f func(key kv.Key, value []byte) bool) error
- func (s ScViewState) MustGet(key kv.Key) []byte
- func (s ScViewState) MustHas(key kv.Key) bool
- func (s ScViewState) MustIterate(prefix kv.Key, f func(key kv.Key, value []byte) bool)
- func (s ScViewState) MustIterateKeys(prefix kv.Key, f func(key kv.Key) bool)
- func (s ScViewState) MustIterateKeysSorted(prefix kv.Key, f func(key kv.Key) bool)
- func (s ScViewState) MustIterateSorted(prefix kv.Key, f func(key kv.Key, value []byte) bool)
- func (s ScViewState) Set(key kv.Key, value []byte)
- type WasmContext
- func (wc *WasmContext) AddFunc(f wasmlib.ScFuncContextFunction) []wasmlib.ScFuncContextFunction
- func (wc *WasmContext) AddView(v wasmlib.ScViewContextFunction) []wasmlib.ScViewContextFunction
- func (wc *WasmContext) Call(ctx interface{}) (dict.Dict, error)
- func (wc *WasmContext) FunctionFromCode(code uint32) string
- func (wc *WasmContext) IsView() bool
- type WasmProcessor
- func (proc *WasmProcessor) GetDefaultEntryPoint() iscp.VMProcessorEntryPoint
- func (proc *WasmProcessor) GetDescription() string
- func (proc *WasmProcessor) GetEntryPoint(code iscp.Hname) (iscp.VMProcessorEntryPoint, bool)
- func (proc *WasmProcessor) GetKvStore(id int32) *wasmhost.KvStoreHost
- func (proc *WasmProcessor) KillContext(id int32)
- type WaspObject
Constants ¶
View Source
const ( FuncDefault = "_default" ViewCopyAllState = "copy_all_state" )
Variables ¶
View Source
var GoWasmVM wasmhost.WasmVM
View Source
var TestMode = false
Functions ¶
func GetArrayObjectID ¶ added in v0.2.0
func GetArrayObjectID(arrayObj WaspObject, index, typeID int32, factory ObjFactory) int32
func GetMapObjectID ¶ added in v0.2.0
func GetMapObjectID(mapObj WaspObject, keyID, typeID int32, factories ObjFactories) int32
func GetProcessor ¶
GetProcessor creates a new Wasm VM processor.
func NewScViewState ¶
func NewScViewState(ctxView iscp.SandboxView) kv.KVStore
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) Int16 ¶ added in v0.2.0
func (d *BytesDecoder) Int16() int16
func (*BytesDecoder) Int32 ¶ added in v0.2.0
func (d *BytesDecoder) Int32() int32
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) Int16 ¶ added in v0.2.0
func (e *BytesEncoder) Int16(value int16) *BytesEncoder
func (*BytesEncoder) Int32 ¶ added in v0.2.0
func (e *BytesEncoder) Int32(value int32) *BytesEncoder
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 // contains filtered or unexported fields }
func NewScContext ¶
func NewScContext(wc *WasmContext, host *wasmhost.KvStoreHost) *ScContext
func (*ScContext) GetObjectID ¶ added in v0.2.0
type ScDict ¶
type ScDict struct {
// contains filtered or unexported fields
}
func NewScBalances ¶
func NewScBalances(wc *WasmContext, keyID int32) *ScDict
func (*ScDict) FindOrMakeObjectID ¶ added in v0.2.0
func (o *ScDict) FindOrMakeObjectID(keyID int32, factory ObjFactory) int32
func (*ScDict) GetObjectID ¶ added in v0.2.0
func (*ScDict) InvalidKey ¶ added in v0.2.0
func (*ScDict) Owner ¶
func (o *ScDict) Owner() WaspObject
func (*ScDict) SetKvStore ¶ added in v0.2.0
type ScExports ¶
type ScExports struct { ScSandboxObject // contains filtered or unexported fields }
func NewScExports ¶
func NewScExports(wc *WasmContext) *ScExports
type ScMaps ¶
type ScMaps struct {
ScSandboxObject
}
func NewScMaps ¶
func NewScMaps(host *wasmhost.KvStoreHost) *ScMaps
func (*ScMaps) GetObjectID ¶ added in v0.2.0
type ScSandboxObject ¶
type ScSandboxObject struct {
ScDict
}
func (*ScSandboxObject) GetBytes ¶
func (o *ScSandboxObject) GetBytes(keyID, typeID int32) []byte
func (*ScSandboxObject) GetObjectID ¶ added in v0.2.0
func (o *ScSandboxObject) GetObjectID(keyID, typeID int32) int32
func (*ScSandboxObject) SetBytes ¶
func (o *ScSandboxObject) SetBytes(keyID, typeID int32, bytes []byte)
type ScTransferInfo ¶
type ScTransferInfo struct { ScSandboxObject // contains filtered or unexported fields }
func NewScTransferInfo ¶
func NewScTransferInfo(wc *WasmContext) *ScTransferInfo
func (*ScTransferInfo) SetBytes ¶
func (o *ScTransferInfo) SetBytes(keyID, typeID int32, bytes []byte)
type ScTransfers ¶
type ScTransfers struct { ScSandboxObject // contains filtered or unexported fields }
func NewScTransfers ¶
func NewScTransfers(wc *WasmContext) *ScTransfers
func (*ScTransfers) GetObjectID ¶ added in v0.2.0
func (a *ScTransfers) GetObjectID(keyID, typeID int32) int32
type ScUtility ¶
type ScUtility struct { ScSandboxObject // contains filtered or unexported fields }
func NewScUtility ¶
func NewScUtility(wc *WasmContext) *ScUtility
type ScViewState ¶
type ScViewState struct {
// contains filtered or unexported fields
}
ScViewState wraps immutable view state into a mutable KVStore with the KVWriter 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) IterateKeys ¶
func (ScViewState) IterateKeysSorted ¶ added in v0.2.0
func (ScViewState) IterateSorted ¶ added in v0.2.0
func (ScViewState) MustIterate ¶
func (ScViewState) MustIterateKeys ¶
func (ScViewState) MustIterateKeysSorted ¶ added in v0.2.0
func (ScViewState) MustIterateSorted ¶ added in v0.2.0
type WasmContext ¶ added in v0.2.0
type WasmContext struct { wasmhost.KvStoreHost // contains filtered or unexported fields }
func NewWasmContext ¶ added in v0.2.0
func NewWasmContext(function string, proc *WasmProcessor) *WasmContext
func (*WasmContext) AddFunc ¶ added in v0.2.0
func (wc *WasmContext) AddFunc(f wasmlib.ScFuncContextFunction) []wasmlib.ScFuncContextFunction
func (*WasmContext) AddView ¶ added in v0.2.0
func (wc *WasmContext) AddView(v wasmlib.ScViewContextFunction) []wasmlib.ScViewContextFunction
func (*WasmContext) Call ¶ added in v0.2.0
func (wc *WasmContext) Call(ctx interface{}) (dict.Dict, error)
func (*WasmContext) FunctionFromCode ¶ added in v0.2.0
func (wc *WasmContext) FunctionFromCode(code uint32) string
func (*WasmContext) IsView ¶ added in v0.2.0
func (wc *WasmContext) IsView() bool
type WasmProcessor ¶ added in v0.2.0
func (*WasmProcessor) GetDefaultEntryPoint ¶ added in v0.2.0
func (proc *WasmProcessor) GetDefaultEntryPoint() iscp.VMProcessorEntryPoint
func (*WasmProcessor) GetDescription ¶ added in v0.2.0
func (proc *WasmProcessor) GetDescription() string
func (*WasmProcessor) GetEntryPoint ¶ added in v0.2.0
func (proc *WasmProcessor) GetEntryPoint(code iscp.Hname) (iscp.VMProcessorEntryPoint, bool)
func (*WasmProcessor) GetKvStore ¶ added in v0.2.0
func (proc *WasmProcessor) GetKvStore(id int32) *wasmhost.KvStoreHost
func (*WasmProcessor) KillContext ¶ added in v0.2.0
func (proc *WasmProcessor) KillContext(id int32)
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
Click to show internal directories.
Click to hide internal directories.