Documentation ¶
Index ¶
- Constants
- Variables
- type Module
- type Modules
- type Sandbox
- func (sbx *Sandbox) Compile(contract *contract.Contract) (string, error)
- func (sbx *Sandbox) Execute(preparedCode string) (string, int64, error)
- func (sbx *Sandbox) Init(vmType vmPoolType)
- func (sbx *Sandbox) Prepare(contract *contract.Contract, function string, args []interface{}) (string, error)
- func (sbx *Sandbox) Release()
- func (sbx *Sandbox) SetGasLimit(limit int64)
- func (sbx *Sandbox) SetHost(host *host.Host)
- func (sbx *Sandbox) SetJSPath(path string, vmType vmPoolType)
- type VM
- type VMPool
- func (vmp *VMPool) Compile(contract *contract.Contract) (string, error)
- func (vmp *VMPool) Init() error
- func (vmp *VMPool) LoadAndCall(host *host.Host, contract *contract.Contract, api string, args ...interface{}) (rtn []interface{}, cost *contract.Cost, err error)
- func (vmp *VMPool) Release()
- func (vmp *VMPool) SetJSPath(path string)
Constants ¶
const ( TransferSuccess = iota TransferInvalidAmount TransferBalanceNotEnough TransferUnexpectedError )
todo replace this error code with c++ error code transfer err list
const ( BlockInfoSuccess = iota BlockInfoUnexpectedError )
blockInfo err list
const ( TxInfoSuccess = iota TxInfoUnexpectedError )
txInfo err list
const ( ContractCallSuccess = iota ContractCallUnexpectedError )
contractCall err list
const ( APICallSuccess = iota APICallUnexpectedError )
APICall err list
const ( ConsoleLogSuccess = iota ConsoleLogUnexpectedError ConsoleLogNoLoggerError ConsoleLogInvalidLogLevelError )
const Console log status
const ( CompileVMPool vmPoolType = iota // vm pool with compiled startup data RunVMPool )
Variables ¶
var CVMInitOnce = sync.Once{}
CVMInitOnce vm init once
var ErrInvalidDbValType = errors.New("invalid db value type")
ErrInvalidDbValType error
Functions ¶
This section is empty.
Types ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module JavaScript module.
type Sandbox ¶
type Sandbox struct {
// contains filtered or unexported fields
}
Sandbox is an execution environment that allows separate, unrelated, JavaScript code to run in a single instance of IVM.
func GetSandbox ¶
func GetSandbox(cSbx C.SandboxPtr) (*Sandbox, bool)
GetSandbox from sandbox map by sandbox ptr
func NewSandbox ¶
NewSandbox generate new sandbox for VM and insert into sandbox map
func (*Sandbox) Prepare ¶
func (sbx *Sandbox) Prepare(contract *contract.Contract, function string, args []interface{}) (string, error)
Prepare for contract, inject code
func (*Sandbox) SetGasLimit ¶
SetGasLimit set gas limit in context
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
VM contains isolate instance, which is a v8 VM with its own heap.
func NewVMWithChannel ¶
NewVMWithChannel return new vm with release channel
type VMPool ¶
type VMPool struct {
// contains filtered or unexported fields
}
VMPool manage all V8VM instance.