Documentation ¶
Index ¶
- Constants
- Variables
- func NewContextServiceResolver(service *ContextService) exec.Resolver
- type CodeManager
- func (c *CodeManager) CompileCode(buf []byte, outputPath string) error
- func (c *CodeManager) GetExecCode(chainId string, contract *commonPb.Contract, byteCode []byte, ...) (exec.Code, error)
- func (c *CodeManager) MakeExecCode(libpath string, contextService *ContextService) (exec.Code, error)
- func (c *CodeManager) RemoveCode(name string)
- type Context
- type ContextService
- func (c *ContextService) CallContract(ctxId int64) int32
- func (c *ContextService) Context(id int64) (*Context, bool)
- func (c *ContextService) DeleteState(ctxId int64) int32
- func (c *ContextService) DestroyContext(ctx *Context)
- func (c *ContextService) EmitEvent(ctxId int64) int32
- func (c *ContextService) ErrorResult(ctxId int64) int32
- func (c *ContextService) GetCallArgs(ctxId int64) int32
- func (c *ContextService) GetState(ctxId int64) int32
- func (c *ContextService) LogMessage(ctxId int64) int32
- func (c *ContextService) MakeContext(contract *commonPb.Contract, txSimContext protocol.TxSimContext, ...) *Context
- func (c *ContextService) NewIterator(ctxId int64) int32
- func (c *ContextService) PutState(ctxId int64) int32
- func (c *ContextService) SetOutput(ctxId int64) int32
- func (c *ContextService) SuccessResult(ctxId int64) int32
- type Limits
- type WxvmInstance
Constants ¶
View Source
const DefaultCap = 10
View Source
const OptLevel = 0
Variables ¶
View Source
var BuiltinResolver = exec.MapResolver(map[string]interface{}{
"env._wxvm_hash": wxvmHash,
"env._wxvm_encode": wxvmEncode,
"env._wxvm_decode": wxvmDecode,
})
BuiltinResolver export
View Source
var MaxLimits = Limits{
Cpu: maxResourceLimit,
}
MaxLimits describes the maximum limit of resources
Functions ¶
func NewContextServiceResolver ¶
func NewContextServiceResolver(service *ContextService) exec.Resolver
Types ¶
type CodeManager ¶
type CodeManager struct {
// contains filtered or unexported fields
}
func NewCodeManager ¶
func NewCodeManager(chainId string, basedir string, log protocol.Logger) *CodeManager
func (*CodeManager) CompileCode ¶
func (c *CodeManager) CompileCode(buf []byte, outputPath string) error
func (*CodeManager) GetExecCode ¶
func (c *CodeManager) GetExecCode(chainId string, contract *commonPb.Contract, byteCode []byte, contextService *ContextService) (exec.Code, error)
func (*CodeManager) MakeExecCode ¶
func (c *CodeManager) MakeExecCode(libpath string, contextService *ContextService) (exec.Code, error)
func (*CodeManager) RemoveCode ¶
func (c *CodeManager) RemoveCode(name string)
type Context ¶
type Context struct { ID int64 Parameters map[string][]byte TxSimContext protocol.TxSimContext ContractId *commonPb.Contract ContractResult *commonPb.ContractResult ContractEvent []*commonPb.ContractEvent // contains filtered or unexported fields }
type ContextService ¶
type ContextService struct {
// contains filtered or unexported fields
}
func NewContextService ¶
func NewContextService(chainId string, log protocol.Logger) *ContextService
NewContextService build a ContextService
func (*ContextService) CallContract ¶
func (c *ContextService) CallContract(ctxId int64) int32
CallContract implements Syscall interface
func (*ContextService) Context ¶
func (c *ContextService) Context(id int64) (*Context, bool)
func (*ContextService) DeleteState ¶
func (c *ContextService) DeleteState(ctxId int64) int32
DeleteState implements Syscall interface
func (*ContextService) DestroyContext ¶
func (c *ContextService) DestroyContext(ctx *Context)
func (*ContextService) EmitEvent ¶
func (c *ContextService) EmitEvent(ctxId int64) int32
func (*ContextService) ErrorResult ¶
func (c *ContextService) ErrorResult(ctxId int64) int32
func (*ContextService) GetCallArgs ¶
func (c *ContextService) GetCallArgs(ctxId int64) int32
GetCallArgs implements Syscall interface
func (*ContextService) GetState ¶
func (c *ContextService) GetState(ctxId int64) int32
GetState implements Syscall interface
func (*ContextService) LogMessage ¶
func (c *ContextService) LogMessage(ctxId int64) int32
LogMessage handle log entry from contract
func (*ContextService) MakeContext ¶
func (c *ContextService) MakeContext(contract *commonPb.Contract, txSimContext protocol.TxSimContext, contractResult *commonPb.ContractResult, parameters map[string][]byte) *Context
func (*ContextService) NewIterator ¶
func (c *ContextService) NewIterator(ctxId int64) int32
NewIterator implements Syscall interface
func (*ContextService) PutState ¶
func (c *ContextService) PutState(ctxId int64) int32
PutState implements Syscall interface
func (*ContextService) SetOutput ¶
func (c *ContextService) SetOutput(ctxId int64) int32
SetOutput implements Syscall interface
func (*ContextService) SuccessResult ¶
func (c *ContextService) SuccessResult(ctxId int64) int32
type Limits ¶
type Limits struct {
Cpu uint64
}
Limits describes the usage or limit of resources
func (*Limits) Add ¶
Add accumulates resource limits, returns self.
func (Limits) Exceed ¶
Exceed judge whether resource exceeds l1
type WxvmInstance ¶
func CreateInstance ¶
func (*WxvmInstance) Abort ¶
func (x *WxvmInstance) Abort(msg string)
func (*WxvmInstance) Exec ¶
func (x *WxvmInstance) Exec() error
func (*WxvmInstance) Release ¶
func (x *WxvmInstance) Release()
func (*WxvmInstance) ResourceUsed ¶
func (x *WxvmInstance) ResourceUsed() Limits
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package pointer exchange pointer between cgo and go
|
Package pointer exchange pointer between cgo and go |
runtime
|
|
Click to show internal directories.
Click to hide internal directories.