Documentation
¶
Index ¶
- Constants
- func MsgName(msgType uint32) string
- type HandleBlockStream
- type HandleQC
- type NewBlockEvent
- type RPC
- type RPCServer
- func (s *RPCServer) GetBlockByID(pid peer.ID, id types.Bytes32) (*block.EscortedBlock, error)
- func (s *RPCServer) GetBlocksFromNumber(pid peer.ID, num uint32) ([]*block.EscortedBlock, error)
- func (s *RPCServer) GetStatus(pid peer.ID) (*Status, error)
- func (s *RPCServer) GetTxs(pid peer.ID) (types.Transactions, error)
- func (s *RPCServer) NotifyNewBlock(pid peer.ID, escortedBlk *block.EscortedBlock) error
- func (s *RPCServer) NotifyNewBlockID(pid peer.ID, id types.Bytes32) error
- func (s *RPCServer) NotifyNewTx(pid peer.ID, tx cmttypes.Tx) error
- func (s *RPCServer) Reply(stream network.Stream, msgType uint32, content interface{}, isResponse bool) error
- func (s *RPCServer) Start(ctx context.Context)
- func (s *RPCServer) Stop()
- func (s *RPCServer) Sync(handler HandleBlockStream)
- type Status
Constants ¶
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HandleBlockStream ¶
type HandleBlockStream func(ctx context.Context, stream <-chan *block.EscortedBlock) error
HandleBlockStream to handle the stream of downloaded blocks in sync process.
type NewBlockEvent ¶
type NewBlockEvent struct {
*block.EscortedBlock
}
NewBlockEvent event emitted when received block announcement.
type RPC ¶
type RPC interface { Notify(ctx context.Context, msgCode uint64, arg interface{}) error Call(ctx context.Context, msgCode uint64, arg interface{}, result interface{}) error String() string Info(msg string, ctx ...interface{}) Debug(msg string, ctx ...interface{}) Warn(msg string, ctx ...interface{}) }
RPC defines RPC interface.
type RPCServer ¶
type RPCServer struct {
// contains filtered or unexported fields
}
RPCServer represents the RPC server
func NewRPCServer ¶
NewRPCServer creates a new RPC server
func (*RPCServer) GetBlockByID ¶
GetBlockByID query block from remote peer by given block ID. It may return nil block even no error.
func (*RPCServer) GetBlocksFromNumber ¶
GetBlocksFromNumber get a batch of blocks starts with num from remote peer.
func (*RPCServer) NotifyNewBlock ¶
NotifyNewBlock notify new block to remote peer.
func (*RPCServer) NotifyNewBlockID ¶
NotifyNewBlockID notify new block ID to remote peer.
func (*RPCServer) NotifyNewTx ¶
NotifyNewTx notify new tx to remote peer.
func (*RPCServer) Sync ¶
func (s *RPCServer) Sync(handler HandleBlockStream)
Sync start synchronization process.
Click to show internal directories.
Click to hide internal directories.