Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAddr(addr string) error
- func CheckStateKey(key string) error
- func CheckStateKeyValue(key string, value []byte) error
- func CheckStateValue(value []byte) error
- func CheckVmMem(mem int) error
- func ConcrateStateJson(v interface{}) (*bytes.Buffer, error)
- func DoContractStateData(src []byte) ([]byte, error)
- func NewStateQueue() *stateQueue
- func NewTransferQueue() *transferQueue
- type BVMEngine
- type Config
- type ContractCode
- type ContractData
- type ISmartConstract
- type TxSync
- type WorkerProc
- func (p *WorkerProc) CCallCommit() error
- func (p *WorkerProc) CCallComplexQuery(key string) ([]byte, error)
- func (p *WorkerProc) CCallCurrentBlockHeight() (uint32, error)
- func (p *WorkerProc) CCallDelGlobalState(key string) error
- func (p *WorkerProc) CCallDelState(key string) error
- func (p *WorkerProc) CCallGetBalance(addr string, assetID uint32) (int64, error)
- func (p *WorkerProc) CCallGetBalances(addr string) (*ltyes.Balance, error)
- func (p *WorkerProc) CCallGetGlobalState(key string) ([]byte, error)
- func (p *WorkerProc) CCallGetState(key string) ([]byte, error)
- func (p *WorkerProc) CCallPutState(key string, value []byte) error
- func (p *WorkerProc) CCallSetGlobalState(key string, value []byte) error
- func (p *WorkerProc) CCallSmartContractCommitted() error
- func (p *WorkerProc) CCallSmartContractFailed() error
- func (p *WorkerProc) CCallTransfer(recipientAddr string, id, amount int64, fee int64) error
- type WorkerProcWithCallback
Constants ¶
View Source
const (
ContractCodeKey = "__CONTRACT_CODE_KEY__"
)
Variables ¶
View Source
var (
ErrNoValidParamsCnt = errors.New("invalid param count")
)
Functions ¶
func CheckStateKey ¶
func CheckStateKeyValue ¶
func CheckStateValue ¶
func CheckVmMem ¶
func ConcrateStateJson ¶
func DoContractStateData ¶
func NewStateQueue ¶
func NewStateQueue() *stateQueue
func NewTransferQueue ¶
func NewTransferQueue() *transferQueue
Types ¶
type Config ¶
type Config struct { LogFile string LogLevel string VMRegistrySize int VMCallStackSize int VMMaxMem int // vm maximum memory size (MB) ExecLimitStackDepth int ExecLimitMaxOpcodeCount int // maximum allow execute opcode count ExecLimitMaxRunTime int // the contract maximum run time (millisecond) ExecLimitMaxScriptSize int // contract script(lua source code) maximum size (byte) ExecLimitMaxStateValueSize int // the max state value size (byte) ExecLimitMaxStateItemCount int // the max state count in one contract ExecLimitMaxStateKeyLength int // max state key length LuaVMExeFilePath string JSVMExeFilePath string BsWorkerCnt int JsWorkerCnt int LuaWorkerCnt int }
Config vm config struct
var VMConf *Config
type ContractCode ¶
type ContractData ¶
type ContractData struct { ContractCode string ContractAddr string ContractParams []string Transaction *proto.Transaction }
func NewContractData ¶
func NewContractData(tx *proto.Transaction) *ContractData
type ISmartConstract ¶
type ISmartConstract interface { GetGlobalState(key string) ([]byte, error) PutGlobalState(key string, value []byte) error DelGlobalState(key string) error GetState(key string) ([]byte, error) PutState(key string, value []byte) error DelState(key string) error ComplexQuery(key string) ([]byte, error) GetBalance(addr string, assetID uint32) (int64, error) GetCurrentBlockHeight() uint32 AddTransfer(fromAddr, toAddr string, assetID uint32, amount, fee int64) error Transfer(tx *proto.Transaction) error GetBalances(addr string) (*ltyes.Balance, error) //GetByRange(startKey, limitKey string) ([]*db.KeyValue, error) CallBack(response *state.CallBackResponse) error }
blockchain should provide the implement to VM
type TxSync ¶
type TxSync struct {
// contains filtered or unexported fields
}
For handle the transacton concurrency processing, to ensure the order of the transaction
var Txsync *TxSync
type WorkerProc ¶
type WorkerProc struct { ContractData *ContractData SCHandler ISmartConstract StateChangeQueue *stateQueue TransferQueue *transferQueue }
func (*WorkerProc) CCallCommit ¶
func (p *WorkerProc) CCallCommit() error
func (*WorkerProc) CCallComplexQuery ¶
func (p *WorkerProc) CCallComplexQuery(key string) ([]byte, error)
func (*WorkerProc) CCallCurrentBlockHeight ¶
func (p *WorkerProc) CCallCurrentBlockHeight() (uint32, error)
func (*WorkerProc) CCallDelGlobalState ¶
func (p *WorkerProc) CCallDelGlobalState(key string) error
func (*WorkerProc) CCallDelState ¶
func (p *WorkerProc) CCallDelState(key string) error
func (*WorkerProc) CCallGetBalance ¶
func (p *WorkerProc) CCallGetBalance(addr string, assetID uint32) (int64, error)
func (*WorkerProc) CCallGetBalances ¶
func (p *WorkerProc) CCallGetBalances(addr string) (*ltyes.Balance, error)
func (*WorkerProc) CCallGetGlobalState ¶
func (p *WorkerProc) CCallGetGlobalState(key string) ([]byte, error)
func (*WorkerProc) CCallGetState ¶
func (p *WorkerProc) CCallGetState(key string) ([]byte, error)
func (*WorkerProc) CCallPutState ¶
func (p *WorkerProc) CCallPutState(key string, value []byte) error
func (*WorkerProc) CCallSetGlobalState ¶
func (p *WorkerProc) CCallSetGlobalState(key string, value []byte) error
func (*WorkerProc) CCallSmartContractCommitted ¶
func (p *WorkerProc) CCallSmartContractCommitted() error
func (*WorkerProc) CCallSmartContractFailed ¶
func (p *WorkerProc) CCallSmartContractFailed() error
func (*WorkerProc) CCallTransfer ¶
func (p *WorkerProc) CCallTransfer(recipientAddr string, id, amount int64, fee int64) error
type WorkerProcWithCallback ¶
type WorkerProcWithCallback struct { WorkProc *WorkerProc Idx int }
Click to show internal directories.
Click to hide internal directories.