net

package
v0.0.0-...-b124b1e Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 默认消息队列buf大小
	DefMsgChanBufSize = 50000
)

Variables

View Source
var (
	// ErrBlockChainNameEmpty is returned when blockchain name is empty
	ErrBlockChainNameEmpty = errors.New("validation error: validatePostTx TxStatus.Bcname can't be null")
	// ErrTxNil is returned when tx is nil
	ErrTxNil = errors.New("validation error: validatePostTx TxStatus.Tx can't be null")
	// ErrBlockIDNil is returned when blockid is nil
	ErrBlockIDNil = errors.New("validation error: validateSendBlock Block.Blockid can't be null")
	// ErrBlockNil is returned when block is nil
	ErrBlockNil = errors.New("validation error: validateSendBlock Block.Block can't be null")
	// ErrTxInvalid is returned when tx invaild
	ErrTxInvalid = errors.New("validation error: tx info is invaild")
)

Functions

func ErrorType

func ErrorType(err error) protos.CoreMessage_ErrorType

Types

type AsyncMsgHandle

type AsyncMsgHandle func(xctx.Context, *protos.CoreMessage)

异步消息处理handle类型

type NetEvent

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

func NewNetEvent

func NewNetEvent(engine base.Engine) (*NetEvent, error)

func (*NetEvent) GetBlock

func (t *NetEvent) GetBlock(ctx xctx.Context, request *protos.CoreMessage) (*protos.InternalBlock, error)

func (*NetEvent) PostTx

func (t *NetEvent) PostTx(ctx xctx.Context, chain base.Chain, tx *protos.Transaction) error

func (*NetEvent) SendBlock

func (t *NetEvent) SendBlock(ctx xctx.Context, chain base.Chain, in *protos.InternalBlock) error

func (*NetEvent) Start

func (t *NetEvent) Start()

阻塞

func (*NetEvent) Stop

func (t *NetEvent) Stop()

func (*NetEvent) Subscriber

func (t *NetEvent) Subscriber() error

Jump to

Keyboard shortcuts

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