58 lines
1.0 KiB
Go
58 lines
1.0 KiB
Go
package service
|
|
|
|
import (
|
|
"reflect"
|
|
|
|
cda "git.loafle.net/commons/di-go/annotation"
|
|
cdr "git.loafle.net/commons/di-go/registry"
|
|
_ "git.loafle.net/overflow/commons-go/core/annotation"
|
|
"git.loafle.net/overflow/probe/client/central"
|
|
)
|
|
|
|
var DataClientServiceType = reflect.TypeOf((*DataClientService)(nil))
|
|
|
|
func init() {
|
|
cdr.RegisterType(DataClientServiceType)
|
|
}
|
|
|
|
type DataClientService struct {
|
|
RPCClientService
|
|
|
|
cda.TypeAnnotation `annotation:"@overflow:RPCService()"`
|
|
}
|
|
|
|
func (s *DataClientService) InitService() error {
|
|
if err := s.RPCClientService.InitService(); nil != err {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (s *DataClientService) StartService() error {
|
|
if err := s.RPCClientService.StartService(); nil != err {
|
|
return err
|
|
}
|
|
|
|
client, err := central.NewData()
|
|
if nil != err {
|
|
return err
|
|
}
|
|
s.client = client
|
|
|
|
if err := s.client.Start(); nil != err {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (s *DataClientService) StopService() {
|
|
s.RPCClientService.StopService()
|
|
|
|
}
|
|
|
|
func (s *DataClientService) DestroyService() {
|
|
s.RPCClientService.DestroyService()
|
|
}
|