Documentation
¶
Index ¶
- Constants
- func CallDeallocate(instance *wasmer.Instance) error
- func GetVmBridgeManager() *vmBridgeManager
- type CMEnvironment
- type InstancesManager
- func (m *InstancesManager) AfterSchedule(blockFingerprint string, blockHeight uint64)
- func (m *InstancesManager) BeforeSchedule(blockFingerprint string, blockHeight uint64)
- func (m *InstancesManager) CloseAVmPool(contractId *commonPb.Contract)
- func (m *InstancesManager) CloseAllVmPool()
- func (m *InstancesManager) CloseRuntimeInstance(contractName string, contractVersion string) error
- func (m *InstancesManager) NewRuntimeInstance(txSimContext protocol.TxSimContext, chainId, method, codePath string, ...) (protocol.RuntimeInstance, error)
- func (m *InstancesManager) ResetAVmPool(contractId *commonPb.Contract)
- func (m *InstancesManager) ResetAllPool()
- func (m *InstancesManager) StartVM() error
- func (m *InstancesManager) StopVM() error
- type RuntimeInstance
- type SimContext
- type WaciInstance
- func (s *WaciInstance) CallContract() int32
- func (s *WaciInstance) CallContractLen() int32
- func (s *WaciInstance) DeleteState() int32
- func (s *WaciInstance) EmitEvent() int32
- func (s *WaciInstance) ErrorResult() int32
- func (s *WaciInstance) ExecuteDDL() int32
- func (s *WaciInstance) ExecuteQuery() int32
- func (s *WaciInstance) ExecuteQueryOne() int32
- func (s *WaciInstance) ExecuteQueryOneLen() int32
- func (s *WaciInstance) ExecuteUpdate() int32
- func (s *WaciInstance) GetBulletProofsResult() int32
- func (s *WaciInstance) GetBulletProofsResultLen() int32
- func (s *WaciInstance) GetPaillierResult() int32
- func (s *WaciInstance) GetPaillierResultLen() int32
- func (s *WaciInstance) GetState() int32
- func (s *WaciInstance) GetStateLen() int32
- func (s *WaciInstance) KvIterator() int32
- func (s *WaciInstance) KvIteratorClose() int32
- func (s *WaciInstance) KvIteratorHasNext() int32
- func (s *WaciInstance) KvIteratorNext() int32
- func (s *WaciInstance) KvIteratorNextLen() int32
- func (s *WaciInstance) KvPreIterator() int32
- func (s *WaciInstance) LogMessage() int32
- func (s *WaciInstance) PutState() int32
- func (s *WaciInstance) RSClose() int32
- func (s *WaciInstance) RSHasNext() int32
- func (s *WaciInstance) RSNext() int32
- func (s *WaciInstance) RSNextLen() int32
- func (s *WaciInstance) SuccessResult() int32
Constants ¶
const ( // InitContractFunc means `init_contract` function name InitContractFunc = "init_contract" // UpgradeContractFunc means `upgrade` function name UpgradeContractFunc = "upgrade" )
Variables ¶
This section is empty.
Functions ¶
func CallDeallocate ¶
func CallDeallocate(instance *wasmer.Instance) error
CallDeallocate deallocate vm memory before closing the instance
func GetVmBridgeManager ¶
func GetVmBridgeManager() *vmBridgeManager
GetVmBridgeManager get singleton vmBridgeManager struct
Types ¶
type CMEnvironment ¶ added in v2.2.0
type CMEnvironment struct {
// contains filtered or unexported fields
}
CMEnvironment comment at next version
type InstancesManager ¶
type InstancesManager struct {
// contains filtered or unexported fields
}
InstancesManager manages vm pools for all contracts
func NewInstancesManager ¶
func NewInstancesManager(chainId string) *InstancesManager
NewInstancesManager return InstancesManager for every chain
func (*InstancesManager) AfterSchedule ¶ added in v2.3.0
func (m *InstancesManager) AfterSchedule(blockFingerprint string, blockHeight uint64)
AfterSchedule print tx log after block schedule
func (*InstancesManager) BeforeSchedule ¶ added in v2.3.0
func (m *InstancesManager) BeforeSchedule(blockFingerprint string, blockHeight uint64)
BeforeSchedule add request before block schedule
func (*InstancesManager) CloseAVmPool ¶
func (m *InstancesManager) CloseAVmPool(contractId *commonPb.Contract)
CloseAVmPool close the contract vm pool
func (*InstancesManager) CloseAllVmPool ¶
func (m *InstancesManager) CloseAllVmPool()
CloseAllVmPool close all contract vm pool
func (*InstancesManager) CloseRuntimeInstance ¶ added in v2.3.0
func (m *InstancesManager) CloseRuntimeInstance( contractName string, contractVersion string) error
CloseRuntimeInstance comment at next version
func (*InstancesManager) NewRuntimeInstance ¶
func (m *InstancesManager) NewRuntimeInstance( txSimContext protocol.TxSimContext, chainId, method, codePath string, contract *commonPb.Contract, byteCode []byte, log protocol.Logger) (protocol.RuntimeInstance, error)
NewRuntimeInstance init vm pool and check byteCode correctness
func (*InstancesManager) ResetAVmPool ¶
func (m *InstancesManager) ResetAVmPool(contractId *commonPb.Contract)
ResetAVmPool reset a contract vm pool install FIXME: 确认函数名是否多了字符A?@taifu
func (*InstancesManager) ResetAllPool ¶
func (m *InstancesManager) ResetAllPool()
ResetAllPool reset all contract pool instance
func (*InstancesManager) StartVM ¶
func (m *InstancesManager) StartVM() error
StartVM comment at next version
func (*InstancesManager) StopVM ¶
func (m *InstancesManager) StopVM() error
StopVM comment at next version
type RuntimeInstance ¶
type RuntimeInstance struct {
// contains filtered or unexported fields
}
RuntimeInstance wasm runtime
func (*RuntimeInstance) Invoke ¶
func (r *RuntimeInstance) Invoke(contract *commonPb.Contract, method string, byteCode []byte, parameters map[string][]byte, txContext protocol.TxSimContext, gasUsed uint64) ( contractResult *commonPb.ContractResult, specialTxType protocol.ExecOrderTxType)
Invoke contract by call vm, implement protocol.RuntimeInstance
func (*RuntimeInstance) Pool ¶
func (r *RuntimeInstance) Pool() *vmPool
Pool comment at next version
type SimContext ¶
type SimContext struct { TxSimContext protocol.TxSimContext Contract *commonPb.Contract ContractResult *commonPb.ContractResult Log *logger.CMLogger Instance *wasmer.Instance CtxPtr int32 GetStateCache []byte // cache call method GetStateLen value result, one cache per transaction ChainId string ContractEvent []*commonPb.ContractEvent SpecialTxType protocol.ExecOrderTxType // contains filtered or unexported fields }
SimContext record the contract context
func NewSimContext ¶
func NewSimContext(method string, log *logger.CMLogger, chainId string) *SimContext
NewSimContext for every transaction
func (*SimContext) CallMethod ¶
func (sc *SimContext) CallMethod(instance *wasmer.Instance) error
CallMethod will call contract method
type WaciInstance ¶
type WaciInstance struct { Sc *SimContext RequestBody []byte // sdk request param Memory []byte // vm memory ChainId string }
WaciInstance record wasmer vm request parameter
func (*WaciInstance) CallContract ¶
func (s *WaciInstance) CallContract() int32
CallContract get cross contract call result from cache
func (*WaciInstance) CallContractLen ¶
func (s *WaciInstance) CallContractLen() int32
CallContractLen invoke cross contract calls, save result to cache and putout result length
func (*WaciInstance) DeleteState ¶
func (s *WaciInstance) DeleteState() int32
DeleteState delete state from chain
func (*WaciInstance) EmitEvent ¶
func (s *WaciInstance) EmitEvent() int32
EmitEvent emit event to chain
func (*WaciInstance) ErrorResult ¶
func (s *WaciInstance) ErrorResult() int32
ErrorResult record the results of contract execution error
func (*WaciInstance) ExecuteDDL ¶
func (s *WaciInstance) ExecuteDDL() int32
ExecuteDDL execute DDL sql, for init_contract or upgrade method. allow table create/alter/drop/truncate
allow: [CREATE TABLE tableName] [ALTER TABLE tableName]
[DROP TABLE tableName] [TRUNCATE TABLE tableName]
not allow: [CREATE DATABASE dbName] [CREATE TABLE dbName.tableName] [ALTER TABLE dbName.tableName]
[DROP DATABASE dbName] [DROP TABLE dbName.tableName] [TRUNCATE TABLE dbName.tableName]
You must have a primary key to create a table
func (*WaciInstance) ExecuteQuery ¶
func (s *WaciInstance) ExecuteQuery() int32
ExecuteQuery execute query sql, return result set index
func (*WaciInstance) ExecuteQueryOne ¶
func (s *WaciInstance) ExecuteQueryOne() int32
ExecuteQueryOne execute query sql, return result set index
func (*WaciInstance) ExecuteQueryOneLen ¶
func (s *WaciInstance) ExecuteQueryOneLen() int32
ExecuteQueryOneLen execute query sql, return result set index
func (*WaciInstance) ExecuteUpdate ¶
func (s *WaciInstance) ExecuteUpdate() int32
ExecuteUpdate execute update and insert sql, allow single row change as: update table set name = 'Tom' where uniqueKey='xxx'
func (*WaciInstance) GetBulletProofsResult ¶
func (s *WaciInstance) GetBulletProofsResult() int32
GetBulletProofsResult get bulletproofs operation result from chain
func (*WaciInstance) GetBulletProofsResultLen ¶
func (s *WaciInstance) GetBulletProofsResultLen() int32
GetBulletProofsResultLen get bulletproofs operation result length from chain
func (*WaciInstance) GetPaillierResult ¶
func (s *WaciInstance) GetPaillierResult() int32
GetPaillierResult get paillier operation result from chain
func (*WaciInstance) GetPaillierResultLen ¶
func (s *WaciInstance) GetPaillierResultLen() int32
GetPaillierResultLen get paillier operation result length from chain
func (*WaciInstance) GetState ¶
func (s *WaciInstance) GetState() int32
GetState get state from chain
func (*WaciInstance) GetStateLen ¶
func (s *WaciInstance) GetStateLen() int32
GetStateLen get state length from chain
func (*WaciInstance) KvIterator ¶
func (s *WaciInstance) KvIterator() int32
KvIterator Select kv statement
func (*WaciInstance) KvIteratorClose ¶
func (s *WaciInstance) KvIteratorClose() int32
KvIteratorClose Close kv statement
func (*WaciInstance) KvIteratorHasNext ¶
func (s *WaciInstance) KvIteratorHasNext() int32
KvIteratorHasNext to determine whether db has next statement
func (*WaciInstance) KvIteratorNext ¶
func (s *WaciInstance) KvIteratorNext() int32
KvIteratorNext to get kv statement
func (*WaciInstance) KvIteratorNextLen ¶
func (s *WaciInstance) KvIteratorNextLen() int32
KvIteratorNextLen comment at next version
func (*WaciInstance) KvPreIterator ¶
func (s *WaciInstance) KvPreIterator() int32
KvPreIterator comment at next version
func (*WaciInstance) LogMessage ¶
func (s *WaciInstance) LogMessage() int32
LogMessage print log to file
func (*WaciInstance) RSHasNext ¶
func (s *WaciInstance) RSHasNext() int32
RSHasNext return is there a next line, 1 is has next row, 0 is no next row
func (*WaciInstance) RSNext ¶
func (s *WaciInstance) RSNext() int32
RSNext get one row from result set
func (*WaciInstance) RSNextLen ¶
func (s *WaciInstance) RSNextLen() int32
RSNextLen get result set length from chain
func (*WaciInstance) SuccessResult ¶
func (s *WaciInstance) SuccessResult() int32
SuccessResult record the results of contract execution success
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package wasmer is a complete and mature WebAssembly runtime for Go based on Wasmer (https://github.com/wasmerio/wasmer).
|
Package wasmer is a complete and mature WebAssembly runtime for Go based on Wasmer (https://github.com/wasmerio/wasmer). |
packaged/include
See https://github.com/golang/go/issues/26366.
|
See https://github.com/golang/go/issues/26366. |
packaged/lib
See https://github.com/golang/go/issues/26366.
|
See https://github.com/golang/go/issues/26366. |
packaged/lib/darwin-aarch64
See https://github.com/golang/go/issues/26366.
|
See https://github.com/golang/go/issues/26366. |
packaged/lib/darwin-amd64
See https://github.com/golang/go/issues/26366.
|
See https://github.com/golang/go/issues/26366. |
packaged/lib/linux-aarch64
See https://github.com/golang/go/issues/26366.
|
See https://github.com/golang/go/issues/26366. |
packaged/lib/linux-amd64
See https://github.com/golang/go/issues/26366.
|
See https://github.com/golang/go/issues/26366. |
packaged/lib/windows-amd64
See https://github.com/golang/go/issues/26366.
|
See https://github.com/golang/go/issues/26366. |