change NewService to New

pull/393/head
Minh Doan 6 years ago committed by Minh Doan
parent 5d90a4d255
commit a962c28ec0
  1. 4
      api/service/blockproposal/service.go
  2. 4
      api/service/clientsupport/service.go
  3. 4
      api/service/consensus/service.go
  4. 4
      api/service/networkinfo/service.go
  5. 4
      api/service/randgen/service.go
  6. 4
      api/service/rconversion/service.go
  7. 4
      api/service/staking/service.go
  8. 16
      node/node.go

@ -12,8 +12,8 @@ type Service struct {
waitForConsensusReady func(readySignal chan struct{}, stopChan chan struct{}, stoppedChan chan struct{}) waitForConsensusReady func(readySignal chan struct{}, stopChan chan struct{}, stoppedChan chan struct{})
} }
// NewService returns new block service. // New returns new block service.
func NewService(readySignal chan struct{}, waitForConsensusReady func(readySignal chan struct{}, stopChan chan struct{}, stoppedChan chan struct{})) *Service { func New(readySignal chan struct{}, waitForConsensusReady func(readySignal chan struct{}, stopChan chan struct{}, stoppedChan chan struct{})) *Service {
return &Service{readySignal: readySignal, waitForConsensusReady: waitForConsensusReady} return &Service{readySignal: readySignal, waitForConsensusReady: waitForConsensusReady}
} }

@ -22,8 +22,8 @@ type Service struct {
port string port string
} }
// NewService returns new client support service. // New returns new client support service.
func NewService(stateReader func() (*state.DB, error), callFaucetContract func(common.Address) common.Hash, ip, nodePort string) *Service { func New(stateReader func() (*state.DB, error), callFaucetContract func(common.Address) common.Hash, ip, nodePort string) *Service {
port, _ := strconv.Atoi(nodePort) port, _ := strconv.Atoi(nodePort)
return &Service{server: clientService.NewServer(stateReader, callFaucetContract), ip: ip, port: strconv.Itoa(port + ClientServicePortDiff)} return &Service{server: clientService.NewServer(stateReader, callFaucetContract), ip: ip, port: strconv.Itoa(port + ClientServicePortDiff)}
} }

@ -14,8 +14,8 @@ type Service struct {
stoppedChan chan struct{} stoppedChan chan struct{}
} }
// NewService returns consensus service. // New returns consensus service.
func NewService(blockChannel chan *types.Block, consensus *consensus.Consensus) *Service { func New(blockChannel chan *types.Block, consensus *consensus.Consensus) *Service {
return &Service{blockChannel: blockChannel, consensus: consensus} return &Service{blockChannel: blockChannel, consensus: consensus}
} }

@ -12,8 +12,8 @@ type Service struct {
peerChan chan *p2p.Peer peerChan chan *p2p.Peer
} }
// NewService returns role conversion service. // New returns role conversion service.
func NewService(peerChan chan *p2p.Peer) *Service { func New(peerChan chan *p2p.Peer) *Service {
return &Service{ return &Service{
stopChan: make(chan struct{}), stopChan: make(chan struct{}),
stoppedChan: make(chan struct{}), stoppedChan: make(chan struct{}),

@ -10,8 +10,8 @@ type Service struct {
stoppedChan chan struct{} stoppedChan chan struct{}
} }
// NewService returns random generation service. // New returns random generation service.
func NewService() *Service { func New() *Service {
return &Service{} return &Service{}
} }

@ -10,8 +10,8 @@ type Service struct {
stoppedChan chan struct{} stoppedChan chan struct{}
} }
// NewService returns role conversion service. // New returns role conversion service.
func NewService() *Service { func New() *Service {
return &Service{} return &Service{}
} }

@ -12,8 +12,8 @@ type Service struct {
peerChan chan *p2p.Peer peerChan chan *p2p.Peer
} }
// NewService returns role conversion service. // New returns role conversion service.
func NewService(peerChan chan *p2p.Peer) *Service { func New(peerChan chan *p2p.Peer) *Service {
return &Service{ return &Service{
stopChan: make(chan struct{}), stopChan: make(chan struct{}),
stoppedChan: make(chan struct{}), stoppedChan: make(chan struct{}),

@ -669,11 +669,11 @@ func (node *Node) setupForShardLeader() {
// Register explorer service. // Register explorer service.
node.serviceManager.RegisterService(service_manager.SupportExplorer, explorer.New(&node.SelfPeer)) node.serviceManager.RegisterService(service_manager.SupportExplorer, explorer.New(&node.SelfPeer))
// Register consensus service. // Register consensus service.
node.serviceManager.RegisterService(service_manager.Consensus, consensus_service.NewService(node.BlockChannel, node.Consensus)) node.serviceManager.RegisterService(service_manager.Consensus, consensus_service.New(node.BlockChannel, node.Consensus))
// Register new block service. // Register new block service.
node.serviceManager.RegisterService(service_manager.BlockProposal, blockproposal.NewService(node.Consensus.ReadySignal, node.WaitForConsensusReady)) node.serviceManager.RegisterService(service_manager.BlockProposal, blockproposal.New(node.Consensus.ReadySignal, node.WaitForConsensusReady))
// Register client support service. // Register client support service.
node.serviceManager.RegisterService(service_manager.ClientSupport, clientsupport.NewService(node.blockchain.State, node.CallFaucetContract, node.SelfPeer.IP, node.SelfPeer.Port)) node.serviceManager.RegisterService(service_manager.ClientSupport, clientsupport.New(node.blockchain.State, node.CallFaucetContract, node.SelfPeer.IP, node.SelfPeer.Port))
} }
func (node *Node) setupForShardValidator() { func (node *Node) setupForShardValidator() {
@ -681,11 +681,11 @@ func (node *Node) setupForShardValidator() {
func (node *Node) setupForBeaconLeader() { func (node *Node) setupForBeaconLeader() {
// Register consensus service. // Register consensus service.
node.serviceManager.RegisterService(service_manager.Consensus, consensus_service.NewService(node.BlockChannel, node.Consensus)) node.serviceManager.RegisterService(service_manager.Consensus, consensus_service.New(node.BlockChannel, node.Consensus))
// Register new block service. // Register new block service.
node.serviceManager.RegisterService(service_manager.BlockProposal, blockproposal.NewService(node.Consensus.ReadySignal, node.WaitForConsensusReady)) node.serviceManager.RegisterService(service_manager.BlockProposal, blockproposal.New(node.Consensus.ReadySignal, node.WaitForConsensusReady))
// Register client support service. // Register client support service.
node.serviceManager.RegisterService(service_manager.ClientSupport, clientsupport.NewService(node.blockchain.State, node.CallFaucetContract, node.SelfPeer.IP, node.SelfPeer.Port)) node.serviceManager.RegisterService(service_manager.ClientSupport, clientsupport.New(node.blockchain.State, node.CallFaucetContract, node.SelfPeer.IP, node.SelfPeer.Port))
} }
func (node *Node) setupForBeaconValidator() { func (node *Node) setupForBeaconValidator() {
@ -694,9 +694,9 @@ func (node *Node) setupForBeaconValidator() {
func (node *Node) setupForNewNode() { func (node *Node) setupForNewNode() {
chanPeer := make(chan *p2p.Peer) chanPeer := make(chan *p2p.Peer)
// Add network info serivce. // Add network info serivce.
node.serviceManager.RegisterService(service_manager.NetworkInfo, networkinfo.NewService(chanPeer)) node.serviceManager.RegisterService(service_manager.NetworkInfo, networkinfo.New(chanPeer))
// Add staking service. // Add staking service.
node.serviceManager.RegisterService(service_manager.Staking, staking.NewService(chanPeer)) node.serviceManager.RegisterService(service_manager.Staking, staking.New(chanPeer))
} }
// ServiceManagerSetup setups service store. // ServiceManagerSetup setups service store.

Loading…
Cancel
Save