From a962c28ec03c7cedd954afb3684dec0463322b80 Mon Sep 17 00:00:00 2001 From: Minh Doan Date: Mon, 4 Feb 2019 16:43:47 -0800 Subject: [PATCH] change NewService to New --- api/service/blockproposal/service.go | 4 ++-- api/service/clientsupport/service.go | 4 ++-- api/service/consensus/service.go | 4 ++-- api/service/networkinfo/service.go | 4 ++-- api/service/randgen/service.go | 4 ++-- api/service/rconversion/service.go | 4 ++-- api/service/staking/service.go | 4 ++-- node/node.go | 16 ++++++++-------- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/api/service/blockproposal/service.go b/api/service/blockproposal/service.go index 304560a6b..d28a87262 100644 --- a/api/service/blockproposal/service.go +++ b/api/service/blockproposal/service.go @@ -12,8 +12,8 @@ type Service struct { waitForConsensusReady func(readySignal chan struct{}, stopChan chan struct{}, stoppedChan chan struct{}) } -// NewService returns new block service. -func NewService(readySignal chan struct{}, waitForConsensusReady func(readySignal chan struct{}, stopChan chan struct{}, stoppedChan chan struct{})) *Service { +// New returns new block service. +func New(readySignal chan struct{}, waitForConsensusReady func(readySignal chan struct{}, stopChan chan struct{}, stoppedChan chan struct{})) *Service { return &Service{readySignal: readySignal, waitForConsensusReady: waitForConsensusReady} } diff --git a/api/service/clientsupport/service.go b/api/service/clientsupport/service.go index 1e669e461..6d2e89ff0 100644 --- a/api/service/clientsupport/service.go +++ b/api/service/clientsupport/service.go @@ -22,8 +22,8 @@ type Service struct { port string } -// NewService returns new client support service. -func NewService(stateReader func() (*state.DB, error), callFaucetContract func(common.Address) common.Hash, ip, nodePort string) *Service { +// New returns new client support service. +func New(stateReader func() (*state.DB, error), callFaucetContract func(common.Address) common.Hash, ip, nodePort string) *Service { port, _ := strconv.Atoi(nodePort) return &Service{server: clientService.NewServer(stateReader, callFaucetContract), ip: ip, port: strconv.Itoa(port + ClientServicePortDiff)} } diff --git a/api/service/consensus/service.go b/api/service/consensus/service.go index 1d87a785f..cc21589c4 100644 --- a/api/service/consensus/service.go +++ b/api/service/consensus/service.go @@ -14,8 +14,8 @@ type Service struct { stoppedChan chan struct{} } -// NewService returns consensus service. -func NewService(blockChannel chan *types.Block, consensus *consensus.Consensus) *Service { +// New returns consensus service. +func New(blockChannel chan *types.Block, consensus *consensus.Consensus) *Service { return &Service{blockChannel: blockChannel, consensus: consensus} } diff --git a/api/service/networkinfo/service.go b/api/service/networkinfo/service.go index b0bac2150..7b78c34a5 100644 --- a/api/service/networkinfo/service.go +++ b/api/service/networkinfo/service.go @@ -12,8 +12,8 @@ type Service struct { peerChan chan *p2p.Peer } -// NewService returns role conversion service. -func NewService(peerChan chan *p2p.Peer) *Service { +// New returns role conversion service. +func New(peerChan chan *p2p.Peer) *Service { return &Service{ stopChan: make(chan struct{}), stoppedChan: make(chan struct{}), diff --git a/api/service/randgen/service.go b/api/service/randgen/service.go index 56d26545c..95e17e6bc 100644 --- a/api/service/randgen/service.go +++ b/api/service/randgen/service.go @@ -10,8 +10,8 @@ type Service struct { stoppedChan chan struct{} } -// NewService returns random generation service. -func NewService() *Service { +// New returns random generation service. +func New() *Service { return &Service{} } diff --git a/api/service/rconversion/service.go b/api/service/rconversion/service.go index 262005fa8..97c40fef3 100644 --- a/api/service/rconversion/service.go +++ b/api/service/rconversion/service.go @@ -10,8 +10,8 @@ type Service struct { stoppedChan chan struct{} } -// NewService returns role conversion service. -func NewService() *Service { +// New returns role conversion service. +func New() *Service { return &Service{} } diff --git a/api/service/staking/service.go b/api/service/staking/service.go index 73659e885..c46e3f60c 100644 --- a/api/service/staking/service.go +++ b/api/service/staking/service.go @@ -12,8 +12,8 @@ type Service struct { peerChan chan *p2p.Peer } -// NewService returns role conversion service. -func NewService(peerChan chan *p2p.Peer) *Service { +// New returns role conversion service. +func New(peerChan chan *p2p.Peer) *Service { return &Service{ stopChan: make(chan struct{}), stoppedChan: make(chan struct{}), diff --git a/node/node.go b/node/node.go index 0a6e16258..61e5e6e57 100644 --- a/node/node.go +++ b/node/node.go @@ -669,11 +669,11 @@ func (node *Node) setupForShardLeader() { // Register explorer service. node.serviceManager.RegisterService(service_manager.SupportExplorer, explorer.New(&node.SelfPeer)) // 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. - 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. - 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() { @@ -681,11 +681,11 @@ func (node *Node) setupForShardValidator() { func (node *Node) setupForBeaconLeader() { // 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. - 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. - 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() { @@ -694,9 +694,9 @@ func (node *Node) setupForBeaconValidator() { func (node *Node) setupForNewNode() { chanPeer := make(chan *p2p.Peer) // 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. - node.serviceManager.RegisterService(service_manager.Staking, staking.NewService(chanPeer)) + node.serviceManager.RegisterService(service_manager.Staking, staking.New(chanPeer)) } // ServiceManagerSetup setups service store.