change service interface for services

pull/366/head
Minh Doan 6 years ago committed by Minh Doan
parent 38f6a1c427
commit 40a9a94244
  1. 8
      api/services/explorer/service.go
  2. 8
      node/service/support_client.go
  3. 4
      node/service_test.go

@ -38,15 +38,15 @@ func New(selfPeer *p2p.Peer) *Service {
} }
} }
// Start starts explorer service. // StartService starts explorer service.
func (s *Service) Start() { func (s *Service) StartService() {
utils.GetLogInstance().Info("Starting explorer service.") utils.GetLogInstance().Info("Starting explorer service.")
s.Init(true) s.Init(true)
s.server = s.Run() s.server = s.Run()
} }
// Stop shutdowns explorer service. // StopService shutdowns explorer service.
func (s *Service) Stop() { func (s *Service) StopService() {
utils.GetLogInstance().Info("Shutting down explorer service.") utils.GetLogInstance().Info("Shutting down explorer service.")
if err := s.server.Shutdown(context.Background()); err != nil { if err := s.server.Shutdown(context.Background()); err != nil {
utils.GetLogInstance().Error("Error when shutting down explorer server", "error", err) utils.GetLogInstance().Error("Error when shutting down explorer server", "error", err)

@ -28,12 +28,12 @@ func NewSupportClient(stateReader func() (*state.DB, error), callFaucetContract
return &SupportClient{server: clientService.NewServer(stateReader, callFaucetContract), ip: ip, port: strconv.Itoa(port + ClientServicePortDiff)} return &SupportClient{server: clientService.NewServer(stateReader, callFaucetContract), ip: ip, port: strconv.Itoa(port + ClientServicePortDiff)}
} }
// Start ... // StartService ...
func (sc *SupportClient) Start() { func (sc *SupportClient) StartService() {
sc.grpcServer, _ = sc.server.Start(sc.ip, sc.port) sc.grpcServer, _ = sc.server.Start(sc.ip, sc.port)
} }
// Stop ... // StopService ...
func (sc *SupportClient) Stop() { func (sc *SupportClient) StopService() {
sc.grpcServer.Stop() sc.grpcServer.Stop()
} }

@ -8,11 +8,11 @@ import (
type SupportSyncingTest struct{} type SupportSyncingTest struct{}
func (s *SupportSyncingTest) Start() { func (s *SupportSyncingTest) StartService() {
fmt.Println("SupportSyncingTest starting") fmt.Println("SupportSyncingTest starting")
} }
func (s *SupportSyncingTest) Stop() { func (s *SupportSyncingTest) StopService() {
fmt.Println("SupportSyncingTest stopping") fmt.Println("SupportSyncingTest stopping")
} }

Loading…
Cancel
Save