Documentation ¶
Index ¶
- Constants
- Variables
- type NetSync
- func (netSync *NetSync) GetCPUUsage()
- func (netSync *NetSync) Init(cfg *NetSyncConfig)
- func (netSync *NetSync) QueueBlock(_ *peer.Peer, msg wire.Message, done chan struct{})
- func (netSync *NetSync) QueueGetBlockBeacon(peer *peer.Peer, msg *wire.MessageGetBlockBeacon, done chan struct{})
- func (netSync *NetSync) QueueGetBlockShard(peer *peer.Peer, msg *wire.MessageGetBlockShard, done chan struct{})
- func (netSync *NetSync) QueueMessage(peer *peer.Peer, msg wire.Message, done chan struct{})
- func (netSync *NetSync) QueueTx(peer *peer.Peer, msg *wire.MessageTx, done chan struct{}) error
- func (netSync *NetSync) QueueTxPrivacyToken(peer *peer.Peer, msg *wire.MessageTxPrivacyToken, done chan struct{}) error
- func (netSync *NetSync) Start() error
- func (netSync *NetSync) Stop()
- type NetSyncCache
- type NetSyncConfig
- type NetSyncError
- type NetSyncLogger
Constants ¶
View Source
const ( UnexpectedError = iota AlreadyStartError AlreadyShutdownError )
Variables ¶
View Source
var ErrCodeMessage = map[int]struct { Code int Message string }{ UnexpectedError: {-1, "Unexpected error"}, AlreadyStartError: {-2, "Already started"}, AlreadyShutdownError: {-3, "We're shutting down"}, }
View Source
var Logger = NetSyncLogger{}
Global instant to use
Functions ¶
This section is empty.
Types ¶
type NetSync ¶
type NetSync struct {
// contains filtered or unexported fields
}
NetSync is a gate for message to enter node from network (after Peerconn), all message must be process by NetSync before proccessed by other package in node NetSync parses message from other peer, identifies type of message After parsing, it will detect if message is duplicate or not If message is duplicate then discard it, otherwise pass it to the right handler NetSync start when node start and run all the time while node is alive and it will stop when received quit signal
func (*NetSync) GetCPUUsage ¶
func (netSync *NetSync) GetCPUUsage()
func (*NetSync) Init ¶
func (netSync *NetSync) Init(cfg *NetSyncConfig)
func (*NetSync) QueueBlock ¶
QueueBlock adds the passed block message and peer to the block handling queue. Responds to the done channel argument after the block message is processed.
func (*NetSync) QueueGetBlockBeacon ¶
func (netSync *NetSync) QueueGetBlockBeacon(peer *peer.Peer, msg *wire.MessageGetBlockBeacon, done chan struct{})
func (*NetSync) QueueGetBlockShard ¶
func (netSync *NetSync) QueueGetBlockShard(peer *peer.Peer, msg *wire.MessageGetBlockShard, done chan struct{})
func (*NetSync) QueueMessage ¶
func (*NetSync) QueueTxPrivacyToken ¶
type NetSyncCache ¶
type NetSyncCache struct {
// contains filtered or unexported fields
}
type NetSyncConfig ¶
type NetSyncConfig struct { Syncker *syncker.SynckerManager BlockChain *blockchain.BlockChain TxMemPool *mempool.TxPool PubSubManager *pubsub.PubSubManager TransactionEvent pubsub.EventChannel // transaction event // RoleInCommitteesEvent pubsub.EventChannel // role in committees event BeaconBlockEvent pubsub.EventChannel // beacon block event ShardBlockEvent pubsub.EventChannel // shard block event RelayShard []byte // RoleInCommittees int // roleInCommitteesMtx sync.RWMutex Server interface { // list functions callback which are assigned from Server struct PushMessageToPeer(wire.Message, libp2p.ID) error PushMessageToAll(wire.Message) error PushMessageToShard(msg wire.Message, shard byte) error } Consensus interface { OnBFTMsg(*wire.MessageBFT) } }
type NetSyncError ¶
func NewNetSyncError ¶
func NewNetSyncError(key int, err error, params ...interface{}) *NetSyncError
func (NetSyncError) Error ¶
func (e NetSyncError) Error() string
type NetSyncLogger ¶
type NetSyncLogger struct {
// contains filtered or unexported fields
}
func (*NetSyncLogger) Init ¶
func (netSyncLogger *NetSyncLogger) Init(inst common.Logger)
Click to show internal directories.
Click to hide internal directories.