netsync

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainMgr

type ChainMgr interface {
	Start() error
	IsCaughtUp() bool
	Stop()
}

ChainMgr is the interface for p2p chain message sync manager.

type ConsensusMgr

type ConsensusMgr interface {
	Start() error
	Stop()
}

ConsensusMgr is the interface for consensus message sync manager.

type Switch

type Switch interface {
	Start() (bool, error)
	Stop() bool
	IsListening() bool
	DialPeerWithAddress(addr *p2p.NetAddress) error
	Peers() *p2p.PeerSet
}

Switch is the interface for p2p switch.

type SyncManager

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

SyncManager Sync Manager is responsible for the business layer information synchronization

func NewSyncManager

func NewSyncManager(config *config.Config, chain *protocol.Chain, txPool *protocol.TxPool, dispatcher *event.Dispatcher) (*SyncManager, error)

NewSyncManager create sync manager and set switch.

func (*SyncManager) BestPeer

func (sm *SyncManager) BestPeer() *peers.PeerInfo

BestPeer fine the peer with the highest height from the connected peers.

func (*SyncManager) DialPeerWithAddress

func (sm *SyncManager) DialPeerWithAddress(addr *p2p.NetAddress) error

DialPeerWithAddress dial the peer and establish a connection.

func (*SyncManager) GetNetwork

func (sm *SyncManager) GetNetwork() string

GetNetwork get the type of network.

func (*SyncManager) GetPeerInfos

func (sm *SyncManager) GetPeerInfos() []*peers.PeerInfo

GetPeerInfos return peer info of all connected peers.

func (*SyncManager) IsCaughtUp

func (sm *SyncManager) IsCaughtUp() bool

IsCaughtUp check wheather the peer finish the sync

func (*SyncManager) IsListening

func (sm *SyncManager) IsListening() bool

IsListening check if the bytomd service port is open?

func (*SyncManager) PeerCount

func (sm *SyncManager) PeerCount() int

PeerCount count the number of connected peers.

func (*SyncManager) Start

func (sm *SyncManager) Start() error

Start message sync manager service.

func (*SyncManager) Stop

func (sm *SyncManager) Stop()

Stop message sync manager service.

func (*SyncManager) StopPeer

func (sm *SyncManager) StopPeer(peerID string) error

StopPeer try to stop peer by given ID

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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