github.com/turingchain2020/turingchain@v1.1.21/client/queueprotocolapi.go (about) 1 // Copyright Turing Corp. 2018 All Rights Reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package client 6 7 import ( 8 "github.com/turingchain2020/turingchain/queue" 9 "github.com/turingchain2020/turingchain/types" 10 ) 11 12 // QueueProtocolAPI 消息通道交互API接口定义 13 type QueueProtocolAPI interface { 14 Version() (*types.VersionInfo, error) 15 Close() 16 NewMessage(topic string, msgid int64, data interface{}) *queue.Message 17 Notify(topic string, ty int64, data interface{}) (*queue.Message, error) 18 // +++++++++++++++ mempool interfaces begin 19 // 同步发送交易信息到指定模块,获取应答消息 types.EventTx 20 SendTx(param *types.Transaction) (*types.Reply, error) 21 // types.EventTxList 22 GetTxList(param *types.TxHashList) (*types.ReplyTxList, error) 23 // types.EventGetMempool 24 GetMempool(req *types.ReqGetMempool) (*types.ReplyTxList, error) 25 // types.EventGetLastMempool 26 GetLastMempool() (*types.ReplyTxList, error) 27 // types.EventGetProperFee 28 GetProperFee(req *types.ReqProperFee) (*types.ReplyProperFee, error) 29 // +++++++++++++++ execs interfaces begin 30 // types.EventBlockChainQuery 31 Query(driver, funcname string, param types.Message) (types.Message, error) 32 QueryConsensus(param *types.ChainExecutor) (types.Message, error) 33 QueryConsensusFunc(driver string, funcname string, param types.Message) (types.Message, error) 34 QueryChain(param *types.ChainExecutor) (types.Message, error) 35 ExecWalletFunc(driver string, funcname string, param types.Message) (types.Message, error) 36 ExecWallet(param *types.ChainExecutor) (types.Message, error) 37 // --------------- execs interfaces end 38 39 // +++++++++++++++ p2p interfaces begin 40 // types.EventPeerInfo 41 PeerInfo(param *types.P2PGetPeerReq) (*types.PeerList, error) 42 // types.EventGetNetInfo 43 GetNetInfo(param *types.P2PGetNetInfoReq) (*types.NodeNetInfo, error) 44 //type.EventNetProtocols 45 NetProtocols(*types.ReqNil) (*types.NetProtocolInfos, error) 46 // --------------- p2p interfaces end 47 // +++++++++++++++ wallet interfaces begin 48 // types.EventLocalGet 49 LocalGet(param *types.LocalDBGet) (*types.LocalReplyValue, error) 50 // types.EventLocalNew 51 LocalNew(readOnly bool) (*types.Int64, error) 52 // types.EventLocalClose 53 LocalClose(param *types.Int64) error 54 // types.EventLocalBeign 55 LocalBegin(param *types.Int64) error 56 // types.EventLocalCommit 57 LocalCommit(param *types.Int64) error 58 // types.EventLocalRollback 59 LocalRollback(param *types.Int64) error 60 // types.EventLocalSet 61 LocalSet(param *types.LocalDBSet) error 62 // types.EventLocalList 63 LocalList(param *types.LocalDBList) (*types.LocalReplyValue, error) 64 // types.EventGetBlocks 65 GetBlocks(param *types.ReqBlocks) (*types.BlockDetails, error) 66 // types.EventQueryTx 67 QueryTx(param *types.ReqHash) (*types.TransactionDetail, error) 68 // types.EventGetTransactionByAddr 69 GetTransactionByAddr(param *types.ReqAddr) (*types.ReplyTxInfos, error) 70 // types.EventGetTransactionByHash 71 GetTransactionByHash(param *types.ReqHashes) (*types.TransactionDetails, error) 72 // types.EventGetHeaders 73 GetHeaders(param *types.ReqBlocks) (*types.Headers, error) 74 // types.EventGetBlockOverview 75 GetBlockOverview(param *types.ReqHash) (*types.BlockOverview, error) 76 // types.EventGetAddrOverview 77 GetAddrOverview(param *types.ReqAddr) (*types.AddrOverview, error) 78 // types.EventGetBlockHash 79 GetBlockHash(param *types.ReqInt) (*types.ReplyHash, error) 80 // types.EventIsSync 81 IsSync() (*types.Reply, error) 82 // types.EventIsNtpClockSync 83 IsNtpClockSync() (*types.Reply, error) 84 // types.EventGetLastHeader 85 GetLastHeader() (*types.Header, error) 86 87 //types.EventGetLastBlockSequence: 88 GetLastBlockSequence() (*types.Int64, error) 89 //types.EventGetBlockSequences: 90 GetBlockSequences(param *types.ReqBlocks) (*types.BlockSequences, error) 91 //types.EventGetBlockByHashes: 92 GetBlockByHashes(param *types.ReqHashes) (*types.BlockDetails, error) 93 //types.EventGetBlockBySeq: 94 GetBlockBySeq(param *types.Int64) (*types.BlockSeq, error) 95 //types.EventGetSequenceByHash: 96 GetSequenceByHash(param *types.ReqHash) (*types.Int64, error) 97 98 // 在平行链上获得主链Sequence相关的接口 99 //types.EventGetLastBlockSequence: 100 GetLastBlockMainSequence() (*types.Int64, error) 101 //types.EventGetSequenceByHash: 102 GetMainSequenceByHash(param *types.ReqHash) (*types.Int64, error) 103 104 // --------------- blockchain interfaces end 105 106 // +++++++++++++++ store interfaces begin 107 StoreSet(param *types.StoreSetWithSync) (*types.ReplyHash, error) 108 StoreGet(*types.StoreGet) (*types.StoreReplyValue, error) 109 StoreMemSet(param *types.StoreSetWithSync) (*types.ReplyHash, error) 110 StoreCommit(param *types.ReqHash) (*types.ReplyHash, error) 111 StoreRollback(param *types.ReqHash) (*types.ReplyHash, error) 112 StoreDel(param *types.StoreDel) (*types.ReplyHash, error) 113 StoreGetTotalCoins(*types.IterateRangeByStateHash) (*types.ReplyGetTotalCoins, error) 114 StoreList(param *types.StoreList) (*types.StoreListReply, error) 115 // --------------- store interfaces end 116 117 // +++++++++++++++ other interfaces begin 118 // close turingchain 119 CloseQueue() (*types.Reply, error) 120 // --------------- other interfaces end 121 // types.EventAddBlockSeqCB 122 AddPushSubscribe(param *types.PushSubscribeReq) (*types.ReplySubscribePush, error) 123 // types.EventListBlockSeqCB 124 ListPushes() (*types.PushSubscribes, error) 125 // types.EventGetSeqCBLastNum 126 GetPushSeqLastNum(param *types.ReqString) (*types.Int64, error) 127 // types.EventGetParaTxByTitle 128 GetParaTxByTitle(param *types.ReqParaTxByTitle) (*types.ParaTxDetails, error) 129 // types.EventGetHeightByTitle 130 LoadParaTxByTitle(param *types.ReqHeightByTitle) (*types.ReplyHeightByTitle, error) 131 // types.EventGetParaTxByTitleAndHeight 132 GetParaTxByHeight(param *types.ReqParaTxByHeight) (*types.ParaTxDetails, error) 133 134 // get chain config 135 GetConfig() *types.TuringchainConfig 136 }