place holder function

pull/370/head
Minh Doan 6 years ago committed by Minh Doan
parent 50e1f1664c
commit 6fb68de941
  1. 26
      node/service/role_conversion.go

@ -16,26 +16,28 @@ func NewRoleConversion() *RoleConversion {
} }
// StartService starts role conversion service. // StartService starts role conversion service.
func (cs *RoleConversion) StartService() { func (rc *RoleConversion) StartService() {
cs.stopChan = make(chan struct{}) rc.stopChan = make(chan struct{})
cs.stoppedChan = make(chan struct{}) rc.stoppedChan = make(chan struct{})
cs.Init() rc.Init()
cs.Run(cs.stopChan, cs.stoppedChan) rc.Run(rc.stopChan, rc.stoppedChan)
} }
// Init initializes role conversion service. // Init initializes role conversion service.
func (cs *RoleConversion) Init() { func (rc *RoleConversion) Init() {
} }
// Run runs role conversion. // Run runs role conversion.
func (cs *RoleConversion) Run(stopChan chan struct{}, stoppedChan chan struct{}) { func (rc *RoleConversion) Run(stopChan chan struct{}, stoppedChan chan struct{}) {
go func() { go func() {
defer close(stoppedChan) defer close(stoppedChan)
for { for {
select { select {
default: default:
utils.GetLogInstance().Info("Running role conversion") utils.GetLogInstance().Info("Running role conversion")
// TODO: Write some logic here.
rc.DoRoleConversion()
case <-stopChan: case <-stopChan:
return return
} }
@ -43,10 +45,14 @@ func (cs *RoleConversion) Run(stopChan chan struct{}, stoppedChan chan struct{})
}() }()
} }
// DoRoleConversion does role conversion.
func (rc *RoleConversion) DoRoleConversion() {
}
// StopService stops role conversion service. // StopService stops role conversion service.
func (cs *RoleConversion) StopService() { func (rc *RoleConversion) StopService() {
utils.GetLogInstance().Info("Stopping role conversion service.") utils.GetLogInstance().Info("Stopping role conversion service.")
cs.stopChan <- struct{}{} rc.stopChan <- struct{}{}
<-cs.stoppedChan <-rc.stoppedChan
utils.GetLogInstance().Info("Role conversion stopped.") utils.GetLogInstance().Info("Role conversion stopped.")
} }

Loading…
Cancel
Save