adapter

package
v0.0.0-...-24d451d Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Routes = map[string]socket.CallBackFunc{
	"get":   SdbGet,
	"set":   SdbSet,
	"build": SdbBuild,
	"block": GetBlock,
}

Functions

func Build

func Build(transID, txID int64, contractMeta std.ContractMeta) (*std.BuildResult, error)

Build build contract and save to sdb

func Get

func Get(transID, txID int64, key string) ([]byte, error)

Get get key's value from sdb

func GetBlock

func GetBlock(req map[string]interface{}) (result interface{}, err error)

func SdbBuild

func SdbBuild(req map[string]interface{}) (result interface{}, err error)

SdbBuild calls sdb build function

func SdbGet

func SdbGet(req map[string]interface{}) (result interface{}, err error)

SdbGet calls sdb get function

func SdbSet

func SdbSet(req map[string]interface{}) (result interface{}, err error)

SdbSet calls sdb set function

func Set

func Set(transID, txID int64, data map[string][]byte) (*bool, error)

Set set key and value to sdb

func SetLogger

func SetLogger(l log.Logger)

func SetSdbCallback

func SetSdbCallback(getFunc GetCallback, setFunc SetCallback, buildCallback BuildCallback)

SetSdbCallback set sdb callback

func Tx

func Tx(txHash string) (result string, err error)

Types

type Adapter

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

Adapter objact of adapter

func GetInstance

func GetInstance() *Adapter

GetInstance get or create adapter instance

func (*Adapter) Commit

func (ad *Adapter) Commit(transID int64)

Commit commit transaction

func (*Adapter) Health

func (ad *Adapter) Health() *types.Health

Health get health status

func (*Adapter) Init

func (ad *Adapter) Init(log log.Logger, rpcPort int)

Init init adapter before using it nolint errcheck

func (*Adapter) InitOrUpdateSMC

func (ad *Adapter) InitOrUpdateSMC(transId, txId int64, header types2.Header, contractAddr, owner types.Address, isUpgarde bool) (result *types.Response)

InitSMC init or upgrade chain for smart contact

func (*Adapter) InvokeTx

func (ad *Adapter) InvokeTx(
	blockHeader types2.Header,
	transID, txID int64,
	sender types.Address,
	tx types.Transaction,
	publicKey types.PubKey,
	txHash types.Hash,
	blockHash types.Hash) *types.Response

InvokeTx calls invokermgr's invoke function

func (*Adapter) Mine

func (ad *Adapter) Mine(transId, txId int64, header types2.Header, contractAddr, owner types.Address) (result *types.Response)

InitSMC mining for smart contact

func (*Adapter) Rollback

func (ad *Adapter) Rollback(transID int64)

Rollback rollback transaction

func (*Adapter) RollbackTx

func (ad *Adapter) RollbackTx(transID, txID int64)

RollbackTx rollback transaction

type BuildCallback

type BuildCallback func(int64, int64, std.ContractMeta) (*std.BuildResult, error)

BuildCallback callback of build()

type GetCallback

type GetCallback func(int64, int64, string) ([]byte, error)

GetCallback callback of get()

type SetCallback

type SetCallback func(int64, int64, map[string][]byte) (*bool, error)

SetCallback callback of set()

Jump to

Keyboard shortcuts

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