Merge pull request #555 from alajko/backup_node

Backup Node
pull/553/head
alajko 6 years ago committed by GitHub
commit 1043300a43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      internal/configs/node/config.go
  2. 11
      node/service_setup.go

@ -27,6 +27,7 @@ const (
NewNode
ClientNode
WalletNode
BackupNode
)
func (role Role) String() string {
@ -47,6 +48,8 @@ func (role Role) String() string {
return "ClientNode"
case WalletNode:
return "WalletNode"
case BackupNode:
return "BackupNode"
}
return "Unknown"
}

@ -105,6 +105,15 @@ func (node *Node) setupForWalletNode() {
node.serviceManager.RegisterService(service.NetworkInfo, networkinfo.New(node.host, p2p.GroupIDBeacon, chanPeer, nil))
}
func (node *Node) setupForBackupNode() {
nodeConfig, chanPeer := node.initNodeConfiguration()
// Register peer discovery service.
node.serviceManager.RegisterService(service.PeerDiscovery, discovery.New(node.host, nodeConfig, chanPeer, node.AddBeaconPeer))
// Register networkinfo service. "0" is the beacon shard ID
node.serviceManager.RegisterService(service.NetworkInfo, networkinfo.New(node.host, p2p.GroupIDBeacon, chanPeer, nil))
//TODO: Add Syncing as a service.
}
// ServiceManagerSetup setups service store.
func (node *Node) ServiceManagerSetup() {
node.serviceManager = &service.Manager{}
@ -124,6 +133,8 @@ func (node *Node) ServiceManagerSetup() {
node.setupForClientNode()
case nodeconfig.WalletNode:
node.setupForWalletNode()
case nodeconfig.BackupNode:
node.setupForBackupNode()
}
node.serviceManager.SetupServiceMessageChan(node.serviceMessageChan)
}

Loading…
Cancel
Save