dapp

package
v0.0.0-...-1c4572a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2018 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TxIndexFrom = 1
	TxIndexTo   = 2
)

Variables

This section is empty.

Functions

func CheckAddress

func CheckAddress(addr string, height int64) error

func DisableLog

func DisableLog()

func ExecAddress

func ExecAddress(name string) string

func HeightIndexStr

func HeightIndexStr(height, index int64) string

func IsDriverAddress

func IsDriverAddress(addr string, height int64) bool

func Register

func Register(name string, create DriverCreate, height int64)

func SetLogLevel

func SetLogLevel(level string)

Types

type Driver

type Driver interface {
	SetStateDB(dbm.KV)
	GetCoinsAccount() *account.DB
	SetLocalDB(dbm.KVDB)
	//当前交易执行器名称
	GetCurrentExecName() string
	//驱动的名字,这个名称是固定的
	GetDriverName() string
	//执行器的别名(一个驱动(code),允许创建多个执行器,类似evm一份代码可以创建多个合约)
	GetName() string
	//设置执行器的真实名称
	SetName(string)
	SetCurrentExecName(string)
	Allow(tx *types.Transaction, index int) error
	IsFriend(myexec []byte, writekey []byte, othertx *types.Transaction) bool
	GetActionName(tx *types.Transaction) string
	SetEnv(height, blocktime int64, difficulty uint64)
	CheckTx(tx *types.Transaction, index int) error
	Exec(tx *types.Transaction, index int) (*types.Receipt, error)
	ExecLocal(tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error)
	ExecDelLocal(tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error)
	Query(funcName string, params []byte) (types.Message, error)
	IsFree() bool
	SetApi(client.QueueProtocolAPI)
	SetTxs(txs []*types.Transaction)
	SetReceipt(receipts []*types.ReceiptData)

	//GetTxs and TxGroup
	GetTxs() []*types.Transaction
	GetTxGroup(index int) ([]*types.Transaction, error)
	GetPayloadValue() types.Message
	GetFuncMap() map[string]reflect.Method
	GetExecutorType() types.ExecutorType
}

func LoadDriver

func LoadDriver(name string, height int64) (driver Driver, err error)

func LoadDriverAllow

func LoadDriverAllow(tx *types.Transaction, index int, height int64) (driver Driver)

type DriverBase

type DriverBase struct {
	// contains filtered or unexported fields
}

func (*DriverBase) Allow

func (d *DriverBase) Allow(tx *types.Transaction, index int) error

默认行为: 名字相同 或者 是平行链

func (*DriverBase) AllowIsSame

func (d *DriverBase) AllowIsSame(execer []byte) bool

func (*DriverBase) AllowIsUserDot1

func (d *DriverBase) AllowIsUserDot1(execer []byte) bool

user.evm

func (*DriverBase) AllowIsUserDot2

func (d *DriverBase) AllowIsUserDot2(execer []byte) bool

user.evm.xxx

func (*DriverBase) CheckSignatureData

func (d *DriverBase) CheckSignatureData(tx *types.Transaction, index int) bool

func (*DriverBase) CheckTx

func (d *DriverBase) CheckTx(tx *types.Transaction, index int) error

默认情况下,tx.To 地址指向合约地址

func (*DriverBase) Exec

func (d *DriverBase) Exec(tx *types.Transaction, index int) (receipt *types.Receipt, err error)

调用子类的CheckTx, 也可以不调用,实现自己的CheckTx

func (*DriverBase) ExecDelLocal

func (d *DriverBase) ExecDelLocal(tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error)

func (*DriverBase) ExecLocal

func (d *DriverBase) ExecLocal(tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error)

func (*DriverBase) GetActionName

func (d *DriverBase) GetActionName(tx *types.Transaction) string

func (*DriverBase) GetAddrTxsCount

func (d *DriverBase) GetAddrTxsCount(reqkey *types.ReqKey) (types.Message, error)

查询指定地址参与的交易计数,用于统计

func (*DriverBase) GetApi

func (d *DriverBase) GetApi() client.QueueProtocolAPI

func (*DriverBase) GetBlockTime

func (d *DriverBase) GetBlockTime() int64

func (*DriverBase) GetCoinsAccount

func (d *DriverBase) GetCoinsAccount() *account.DB

func (*DriverBase) GetCurrentExecName

func (d *DriverBase) GetCurrentExecName() string

func (*DriverBase) GetDifficulty

func (d *DriverBase) GetDifficulty() uint64

func (*DriverBase) GetExecutorType

func (d *DriverBase) GetExecutorType() types.ExecutorType

func (*DriverBase) GetFuncMap

func (d *DriverBase) GetFuncMap() map[string]reflect.Method

func (*DriverBase) GetHeight

func (d *DriverBase) GetHeight() int64

func (*DriverBase) GetLocalDB

func (d *DriverBase) GetLocalDB() dbm.KVDB

func (*DriverBase) GetName

func (d *DriverBase) GetName() string

func (*DriverBase) GetPayloadValue

func (d *DriverBase) GetPayloadValue() types.Message

func (*DriverBase) GetPrefixCount

func (d *DriverBase) GetPrefixCount(key *types.ReqKey) (types.Message, error)

查询指定prefix的key数量,用于统计

func (*DriverBase) GetReceipt

func (d *DriverBase) GetReceipt() []*types.ReceiptData

func (*DriverBase) GetStateDB

func (d *DriverBase) GetStateDB() dbm.KV

func (*DriverBase) GetTxGroup

func (d *DriverBase) GetTxGroup(index int) ([]*types.Transaction, error)

func (*DriverBase) GetTxs

func (d *DriverBase) GetTxs() []*types.Transaction

func (*DriverBase) GetTxsByAddr

func (d *DriverBase) GetTxsByAddr(addr *types.ReqAddr) (types.Message, error)

通过addr前缀查找本地址参与的所有交易 查询交易默认放到:coins 中查询

func (*DriverBase) IsFree

func (d *DriverBase) IsFree() bool

func (*DriverBase) IsFriend

func (d *DriverBase) IsFriend(myexec, writekey []byte, othertx *types.Transaction) bool

func (*DriverBase) Query

func (d *DriverBase) Query(funcname string, params []byte) (msg types.Message, err error)

func (*DriverBase) SetApi

func (d *DriverBase) SetApi(api client.QueueProtocolAPI)

func (*DriverBase) SetChild

func (d *DriverBase) SetChild(e Driver)

func (*DriverBase) SetCurrentExecName

func (d *DriverBase) SetCurrentExecName(name string)

func (*DriverBase) SetEnv

func (d *DriverBase) SetEnv(height, blocktime int64, difficulty uint64)

func (*DriverBase) SetExecutorType

func (d *DriverBase) SetExecutorType(e types.ExecutorType)

func (*DriverBase) SetIsFree

func (d *DriverBase) SetIsFree(isFree bool)

func (*DriverBase) SetLocalDB

func (d *DriverBase) SetLocalDB(db dbm.KVDB)

func (*DriverBase) SetName

func (d *DriverBase) SetName(name string)

func (*DriverBase) SetReceipt

func (d *DriverBase) SetReceipt(receipts []*types.ReceiptData)

func (*DriverBase) SetStateDB

func (d *DriverBase) SetStateDB(db dbm.KV)

func (*DriverBase) SetTxs

func (d *DriverBase) SetTxs(txs []*types.Transaction)

type DriverCreate

type DriverCreate func() Driver

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL