client

package
v1.66.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: BSD-3-Clause Imports: 9 Imported by: 121

Documentation

Overview

Package client 系统接口客户端: 封装 Queue Event

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QueueProtocol

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

QueueProtocol 消息通道协议实现

func (*QueueProtocol) AddBlacklist added in v1.65.3

func (q *QueueProtocol) AddBlacklist(req *types.BlackPeer) (*types.Reply, error)

AddBlacklist add peer to blacklist

func (*QueueProtocol) AddPushSubscribe added in v1.65.0

func (q *QueueProtocol) AddPushSubscribe(param *types.PushSubscribeReq) (*types.ReplySubscribePush, error)

AddPushSubscribe Add Seq CallBack

func (*QueueProtocol) Close

func (q *QueueProtocol) Close()

Close close client

func (*QueueProtocol) ClosePeer added in v1.65.3

func (q *QueueProtocol) ClosePeer(req *types.SetPeer) (*types.Reply, error)

ClosePeer close the specified peer

func (*QueueProtocol) CloseQueue

func (q *QueueProtocol) CloseQueue() (*types.Reply, error)

CloseQueue close client queue

func (*QueueProtocol) DelBlacklist added in v1.65.3

func (q *QueueProtocol) DelBlacklist(req *types.BlackPeer) (*types.Reply, error)

DelBlacklist delete peer from blacklist

func (*QueueProtocol) DialPeer added in v1.65.3

func (q *QueueProtocol) DialPeer(req *types.SetPeer) (*types.Reply, error)

DialPeer dial the the specified peer

func (*QueueProtocol) ExecWallet

func (q *QueueProtocol) ExecWallet(param *types.ChainExecutor) (types.Message, error)

ExecWallet exec wallet function

func (*QueueProtocol) ExecWalletFunc

func (q *QueueProtocol) ExecWalletFunc(driver string, funcname string, param types.Message) (types.Message, error)

ExecWalletFunc exec wallet function interface

func (*QueueProtocol) GetAddrOverview

func (q *QueueProtocol) GetAddrOverview(param *types.ReqAddr) (*types.AddrOverview, error)

GetAddrOverview get block head detil by address

func (*QueueProtocol) GetBlockByHashes

func (q *QueueProtocol) GetBlockByHashes(param *types.ReqHashes) (*types.BlockDetails, error)

GetBlockByHashes get block detail list by hash list

func (*QueueProtocol) GetBlockBySeq

func (q *QueueProtocol) GetBlockBySeq(param *types.Int64) (*types.BlockSeq, error)

GetBlockBySeq get block detail and hash by seq

func (*QueueProtocol) GetBlockHash

func (q *QueueProtocol) GetBlockHash(param *types.ReqInt) (*types.ReplyHash, error)

GetBlockHash get blockHash by height

func (*QueueProtocol) GetBlockOverview

func (q *QueueProtocol) GetBlockOverview(param *types.ReqHash) (*types.BlockOverview, error)

GetBlockOverview get block head detil by hash

func (*QueueProtocol) GetBlockSequences

func (q *QueueProtocol) GetBlockSequences(param *types.ReqBlocks) (*types.BlockSequences, error)

GetBlockSequences block执行序列号

func (*QueueProtocol) GetBlocks

func (q *QueueProtocol) GetBlocks(param *types.ReqBlocks) (*types.BlockDetails, error)

GetBlocks get block detail from blockchain

func (*QueueProtocol) GetConfig

func (q *QueueProtocol) GetConfig() *types.Chain33Config

GetConfig 通过seq以及title获取对应平行连的交易

func (*QueueProtocol) GetCryptoList added in v1.65.3

func (q *QueueProtocol) GetCryptoList() *types.CryptoList

GetCryptoList 获取加密算法列表

func (*QueueProtocol) GetHeaders

func (q *QueueProtocol) GetHeaders(param *types.ReqBlocks) (*types.Headers, error)

GetHeaders get block headers by height

func (*QueueProtocol) GetLastBlockMainSequence

func (q *QueueProtocol) GetLastBlockMainSequence() (*types.Int64, error)

GetLastBlockMainSequence 获取最新的block执行序列号

func (*QueueProtocol) GetLastBlockSequence

func (q *QueueProtocol) GetLastBlockSequence() (*types.Int64, error)

GetLastBlockSequence 获取最新的block执行序列号

func (*QueueProtocol) GetLastHeader

func (q *QueueProtocol) GetLastHeader() (*types.Header, error)

GetLastHeader get the current head detail

func (*QueueProtocol) GetLastMempool

func (q *QueueProtocol) GetLastMempool() (*types.ReplyTxList, error)

GetLastMempool get transactions from last mempool

func (*QueueProtocol) GetMainSequenceByHash

func (q *QueueProtocol) GetMainSequenceByHash(param *types.ReqHash) (*types.Int64, error)

GetMainSequenceByHash 通过hash获取对应的执行序列号

func (*QueueProtocol) GetMempool

func (q *QueueProtocol) GetMempool(req *types.ReqGetMempool) (*types.ReplyTxList, error)

GetMempool get transactions from mempool

func (*QueueProtocol) GetNetInfo

func (q *QueueProtocol) GetNetInfo(req *types.P2PGetNetInfoReq) (*types.NodeNetInfo, error)

GetNetInfo get the net information

func (*QueueProtocol) GetParaTxByHeight

func (q *QueueProtocol) GetParaTxByHeight(param *types.ReqParaTxByHeight) (*types.ParaTxDetails, error)

GetParaTxByHeight //通过区块高度列表+title获取平行链交易

func (*QueueProtocol) GetParaTxByTitle

func (q *QueueProtocol) GetParaTxByTitle(param *types.ReqParaTxByTitle) (*types.ParaTxDetails, error)

GetParaTxByTitle 通过seq以及title获取对应平行连的交易

func (*QueueProtocol) GetProperFee

func (q *QueueProtocol) GetProperFee(req *types.ReqProperFee) (*types.ReplyProperFee, error)

GetProperFee get proper fee from mempool

func (*QueueProtocol) GetPushSeqLastNum added in v1.65.0

func (q *QueueProtocol) GetPushSeqLastNum(param *types.ReqString) (*types.Int64, error)

GetPushSeqLastNum Get Seq Call Back Last Num

func (*QueueProtocol) GetSequenceByHash

func (q *QueueProtocol) GetSequenceByHash(param *types.ReqHash) (*types.Int64, error)

GetSequenceByHash 通过hash获取对应的执行序列号

func (*QueueProtocol) GetTransactionByAddr

func (q *QueueProtocol) GetTransactionByAddr(param *types.ReqAddr) (*types.ReplyTxInfos, error)

GetTransactionByAddr get transaction by address

func (*QueueProtocol) GetTransactionByHash

func (q *QueueProtocol) GetTransactionByHash(param *types.ReqHashes) (*types.TransactionDetails, error)

GetTransactionByHash get transactions by hash from blockchain

func (*QueueProtocol) GetTxList

func (q *QueueProtocol) GetTxList(param *types.TxHashList) (*types.ReplyTxList, error)

GetTxList get transactions from mempool

func (*QueueProtocol) IsNtpClockSync

func (q *QueueProtocol) IsNtpClockSync() (*types.Reply, error)

IsNtpClockSync query the ntp clock sync state

func (*QueueProtocol) IsSync

func (q *QueueProtocol) IsSync() (*types.Reply, error)

IsSync query the blockchain sync state

func (*QueueProtocol) ListPushes added in v1.65.0

func (q *QueueProtocol) ListPushes() (*types.PushSubscribes, error)

ListPushes List Seq CallBacks

func (*QueueProtocol) LoadParaTxByTitle

func (q *QueueProtocol) LoadParaTxByTitle(param *types.ReqHeightByTitle) (*types.ReplyHeightByTitle, error)

LoadParaTxByTitle //获取拥有此title交易的区块高度

func (*QueueProtocol) LocalBegin

func (q *QueueProtocol) LocalBegin(param *types.Int64) error

LocalBegin begin a transaction

func (*QueueProtocol) LocalClose

func (q *QueueProtocol) LocalClose(param *types.Int64) error

LocalClose begin a transaction

func (*QueueProtocol) LocalCommit

func (q *QueueProtocol) LocalCommit(param *types.Int64) error

LocalCommit commit a transaction

func (*QueueProtocol) LocalGet

func (q *QueueProtocol) LocalGet(param *types.LocalDBGet) (*types.LocalReplyValue, error)

LocalGet get value from local db by key

func (*QueueProtocol) LocalList

func (q *QueueProtocol) LocalList(param *types.LocalDBList) (*types.LocalReplyValue, error)

LocalList get value list from local db by key list

func (*QueueProtocol) LocalNew

func (q *QueueProtocol) LocalNew(readOnly bool) (*types.Int64, error)

LocalNew new a localdb object

func (*QueueProtocol) LocalRollback

func (q *QueueProtocol) LocalRollback(param *types.Int64) error

LocalRollback rollback a transaction

func (*QueueProtocol) LocalSet

func (q *QueueProtocol) LocalSet(param *types.LocalDBSet) error

LocalSet set key value in local db

func (*QueueProtocol) NetProtocols added in v1.65.0

func (q *QueueProtocol) NetProtocols(req *types.ReqNil) (*types.NetProtocolInfos, error)

NetProtocols protocols list

func (*QueueProtocol) NewMessage

func (q *QueueProtocol) NewMessage(topic string, msgid int64, data interface{}) *queue.Message

NewMessage new message

func (*QueueProtocol) Notify

func (q *QueueProtocol) Notify(topic string, ty int64, data interface{}) (*queue.Message, error)

Notify new and send client message

func (*QueueProtocol) PeerInfo

func (q *QueueProtocol) PeerInfo(req *types.P2PGetPeerReq) (*types.PeerList, error)

PeerInfo query peer list

func (*QueueProtocol) Query

func (q *QueueProtocol) Query(driver, funcname string, param types.Message) (types.Message, error)

Query the query interface

func (*QueueProtocol) QueryChain

func (q *QueueProtocol) QueryChain(param *types.ChainExecutor) (types.Message, error)

QueryChain query chain

func (*QueueProtocol) QueryConsensus

func (q *QueueProtocol) QueryConsensus(param *types.ChainExecutor) (types.Message, error)

QueryConsensus query consensus data

func (*QueueProtocol) QueryConsensusFunc

func (q *QueueProtocol) QueryConsensusFunc(driver string, funcname string, param types.Message) (types.Message, error)

QueryConsensusFunc query consensus function

func (*QueueProtocol) QueryTx

func (q *QueueProtocol) QueryTx(param *types.ReqHash) (*types.TransactionDetail, error)

QueryTx query transaction detail by transaction hash from blockchain

func (*QueueProtocol) SendDelayTx added in v1.65.3

func (q *QueueProtocol) SendDelayTx(param *types.DelayTx, waitReply bool) (*types.Reply, error)

SendDelayTx send delay transaction to mempool

func (*QueueProtocol) SendTx

func (q *QueueProtocol) SendTx(param *types.Transaction) (*types.Reply, error)

SendTx send transaction to mempool

func (*QueueProtocol) ShowBlacklist added in v1.65.3

func (q *QueueProtocol) ShowBlacklist(req *types.ReqNil) (*types.Blacklist, error)

ShowBlacklist show all blacklist peers

func (*QueueProtocol) StoreCommit

func (q *QueueProtocol) StoreCommit(param *types.ReqHash) (*types.ReplyHash, error)

StoreCommit commit kvs by statehash to statedb

func (*QueueProtocol) StoreDel

func (q *QueueProtocol) StoreDel(param *types.StoreDel) (*types.ReplyHash, error)

StoreDel del kvs by statehash to statedb

func (*QueueProtocol) StoreGet

func (q *QueueProtocol) StoreGet(param *types.StoreGet) (*types.StoreReplyValue, error)

StoreGet get value by statehash and key from statedb

func (*QueueProtocol) StoreGetTotalCoins

func (q *QueueProtocol) StoreGetTotalCoins(param *types.IterateRangeByStateHash) (*types.ReplyGetTotalCoins, error)

StoreGetTotalCoins get total coins from statedb

func (*QueueProtocol) StoreList

func (q *QueueProtocol) StoreList(param *types.StoreList) (*types.StoreListReply, error)

StoreList query list from statedb

func (*QueueProtocol) StoreMemSet

func (q *QueueProtocol) StoreMemSet(param *types.StoreSetWithSync) (*types.ReplyHash, error)

StoreMemSet Memset kvs by statehash to statedb

func (*QueueProtocol) StoreRollback

func (q *QueueProtocol) StoreRollback(param *types.ReqHash) (*types.ReplyHash, error)

StoreRollback rollback kvs by statehash to statedb

func (*QueueProtocol) StoreSet

func (q *QueueProtocol) StoreSet(param *types.StoreSetWithSync) (*types.ReplyHash, error)

StoreSet set value by statehash and key to statedb

func (*QueueProtocol) Version

func (q *QueueProtocol) Version() (*types.VersionInfo, error)

Version get the software version

type QueueProtocolAPI

type QueueProtocolAPI interface {
	Version() (*types.VersionInfo, error)
	Close()
	NewMessage(topic string, msgid int64, data interface{}) *queue.Message
	Notify(topic string, ty int64, data interface{}) (*queue.Message, error)
	// +++++++++++++++ mempool interfaces begin
	// 同步发送交易信息到指定模块,获取应答消息 types.EventTx
	SendTx(param *types.Transaction) (*types.Reply, error)
	// types.EventTxList
	GetTxList(param *types.TxHashList) (*types.ReplyTxList, error)
	// types.EventGetMempool
	GetMempool(req *types.ReqGetMempool) (*types.ReplyTxList, error)
	// types.EventGetLastMempool
	GetLastMempool() (*types.ReplyTxList, error)
	// types.EventGetProperFee
	GetProperFee(req *types.ReqProperFee) (*types.ReplyProperFee, error)
	// +++++++++++++++ execs interfaces begin
	// types.EventBlockChainQuery
	Query(driver, funcname string, param types.Message) (types.Message, error)
	QueryConsensus(param *types.ChainExecutor) (types.Message, error)
	QueryConsensusFunc(driver string, funcname string, param types.Message) (types.Message, error)
	QueryChain(param *types.ChainExecutor) (types.Message, error)
	ExecWalletFunc(driver string, funcname string, param types.Message) (types.Message, error)
	ExecWallet(param *types.ChainExecutor) (types.Message, error)

	// +++++++++++++++ p2p interfaces begin
	// types.EventPeerInfo
	PeerInfo(param *types.P2PGetPeerReq) (*types.PeerList, error)
	// types.EventGetNetInfo
	GetNetInfo(param *types.P2PGetNetInfoReq) (*types.NodeNetInfo, error)
	//type.EventNetProtocols
	NetProtocols(*types.ReqNil) (*types.NetProtocolInfos, error)
	// --------------- p2p interfaces end
	// +++++++++++++++ wallet interfaces begin
	// types.EventLocalGet
	LocalGet(param *types.LocalDBGet) (*types.LocalReplyValue, error)
	// types.EventLocalNew
	LocalNew(readOnly bool) (*types.Int64, error)
	// types.EventLocalClose
	LocalClose(param *types.Int64) error
	// types.EventLocalBeign
	LocalBegin(param *types.Int64) error
	// types.EventLocalCommit
	LocalCommit(param *types.Int64) error
	// types.EventLocalRollback
	LocalRollback(param *types.Int64) error
	// types.EventLocalSet
	LocalSet(param *types.LocalDBSet) error
	// types.EventLocalList
	LocalList(param *types.LocalDBList) (*types.LocalReplyValue, error)
	// types.EventGetBlocks
	GetBlocks(param *types.ReqBlocks) (*types.BlockDetails, error)
	// types.EventQueryTx
	QueryTx(param *types.ReqHash) (*types.TransactionDetail, error)
	// types.EventGetTransactionByAddr
	GetTransactionByAddr(param *types.ReqAddr) (*types.ReplyTxInfos, error)
	// types.EventGetTransactionByHash
	GetTransactionByHash(param *types.ReqHashes) (*types.TransactionDetails, error)
	// types.EventGetHeaders
	GetHeaders(param *types.ReqBlocks) (*types.Headers, error)
	// types.EventGetBlockOverview
	GetBlockOverview(param *types.ReqHash) (*types.BlockOverview, error)
	// types.EventGetAddrOverview
	GetAddrOverview(param *types.ReqAddr) (*types.AddrOverview, error)
	// types.EventGetBlockHash
	GetBlockHash(param *types.ReqInt) (*types.ReplyHash, error)
	// types.EventIsSync
	IsSync() (*types.Reply, error)
	// types.EventIsNtpClockSync
	IsNtpClockSync() (*types.Reply, error)
	// types.EventGetLastHeader
	GetLastHeader() (*types.Header, error)

	//types.EventGetLastBlockSequence:
	GetLastBlockSequence() (*types.Int64, error)
	//types.EventGetBlockSequences:
	GetBlockSequences(param *types.ReqBlocks) (*types.BlockSequences, error)
	//types.EventGetBlockByHashes:
	GetBlockByHashes(param *types.ReqHashes) (*types.BlockDetails, error)
	//types.EventGetBlockBySeq:
	GetBlockBySeq(param *types.Int64) (*types.BlockSeq, error)
	//types.EventGetSequenceByHash:
	GetSequenceByHash(param *types.ReqHash) (*types.Int64, error)

	// 在平行链上获得主链Sequence相关的接口
	//types.EventGetLastBlockSequence:
	GetLastBlockMainSequence() (*types.Int64, error)
	//types.EventGetSequenceByHash:
	GetMainSequenceByHash(param *types.ReqHash) (*types.Int64, error)

	// +++++++++++++++ store interfaces begin
	StoreSet(param *types.StoreSetWithSync) (*types.ReplyHash, error)
	StoreGet(*types.StoreGet) (*types.StoreReplyValue, error)
	StoreMemSet(param *types.StoreSetWithSync) (*types.ReplyHash, error)
	StoreCommit(param *types.ReqHash) (*types.ReplyHash, error)
	StoreRollback(param *types.ReqHash) (*types.ReplyHash, error)
	StoreDel(param *types.StoreDel) (*types.ReplyHash, error)
	StoreGetTotalCoins(*types.IterateRangeByStateHash) (*types.ReplyGetTotalCoins, error)
	StoreList(param *types.StoreList) (*types.StoreListReply, error)

	// +++++++++++++++ other interfaces begin
	// close chain33
	CloseQueue() (*types.Reply, error)
	// --------------- other interfaces end
	// types.EventAddBlockSeqCB
	AddPushSubscribe(param *types.PushSubscribeReq) (*types.ReplySubscribePush, error)
	// types.EventListBlockSeqCB
	ListPushes() (*types.PushSubscribes, error)
	// types.EventGetSeqCBLastNum
	GetPushSeqLastNum(param *types.ReqString) (*types.Int64, error)
	// types.EventGetParaTxByTitle
	GetParaTxByTitle(param *types.ReqParaTxByTitle) (*types.ParaTxDetails, error)
	// types.EventGetHeightByTitle
	LoadParaTxByTitle(param *types.ReqHeightByTitle) (*types.ReplyHeightByTitle, error)
	// types.EventGetParaTxByTitleAndHeight
	GetParaTxByHeight(param *types.ReqParaTxByHeight) (*types.ParaTxDetails, error)

	// get chain config
	GetConfig() *types.Chain33Config

	// get crypto list
	GetCryptoList() *types.CryptoList

	// send delay tx
	SendDelayTx(param *types.DelayTx, waitReply bool) (*types.Reply, error)
	//AddBlacklist add blacklist
	AddBlacklist(req *types.BlackPeer) (*types.Reply, error)
	//DelBlacklist  del blacklist
	DelBlacklist(req *types.BlackPeer) (*types.Reply, error)
	//ShowBlacklist  show blacklist
	ShowBlacklist(req *types.ReqNil) (*types.Blacklist, error)
	//DialPeer dial the specified  peer
	DialPeer(in *types.SetPeer) (*types.Reply, error)
	//ClosePeer close specified peer
	ClosePeer(in *types.SetPeer) (*types.Reply, error)
}

QueueProtocolAPI 消息通道交互API接口定义

func New

func New(client queue.Client, option *QueueProtocolOption) (QueueProtocolAPI, error)

New New QueueProtocolAPI interface

type QueueProtocolOption

type QueueProtocolOption struct {
	// 发送请求超时时间
	SendTimeout time.Duration
	// 接收应答超时时间
	WaitTimeout time.Duration
}

QueueProtocolOption queue protocol option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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