Documentation ¶
Index ¶
- type ChainMgr
- type ConsensusMgr
- type Switch
- type SyncManager
- func (sm *SyncManager) BestPeer() *peers.PeerInfo
- func (sm *SyncManager) DialPeerWithAddress(addr *p2p.NetAddress) error
- func (sm *SyncManager) GetNetwork() string
- func (sm *SyncManager) GetPeerInfos() []*peers.PeerInfo
- func (sm *SyncManager) IsCaughtUp() bool
- func (sm *SyncManager) IsListening() bool
- func (sm *SyncManager) PeerCount() int
- func (sm *SyncManager) Start() error
- func (sm *SyncManager) Stop()
- func (sm *SyncManager) StopPeer(peerID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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, fastSyncDB dbm.DB) (*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 vapord 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) StopPeer ¶
func (sm *SyncManager) StopPeer(peerID string) error
StopPeer try to stop peer by given ID