overflow_discovery/server/server_handlers.go

48 lines
1.0 KiB
Go
Raw Normal View History

2017-10-26 12:55:55 +00:00
package server
import (
2018-03-27 09:51:48 +00:00
"reflect"
2017-11-15 06:59:43 +00:00
"git.loafle.net/commons_go/server"
2017-12-05 05:58:32 +00:00
oopcs "git.loafle.net/overflow/overflow_probe_container/server"
2017-10-26 12:55:55 +00:00
)
2018-03-27 09:51:48 +00:00
func newServerHandler(pidPath string, socketHandler SocketHandler, services []interface{}, servicesToStartAndStop []reflect.Type) ServerHandler {
2017-12-05 05:58:32 +00:00
sh := &ServerHandlers{}
2018-03-27 09:51:48 +00:00
sh.ServerHandler = oopcs.NewServerHandler(pidPath, "Discovery Containter", socketHandler, services, servicesToStartAndStop)
2017-11-01 06:35:03 +00:00
2017-10-26 12:55:55 +00:00
return sh
}
type ServerHandlers struct {
2017-12-05 05:58:32 +00:00
oopcs.ServerHandler
2017-11-15 06:59:43 +00:00
}
2017-11-29 05:19:36 +00:00
func (sh *ServerHandlers) Init(serverCTX server.ServerContext) error {
2017-12-05 05:58:32 +00:00
if err := sh.ServerHandler.Init(serverCTX); nil != err {
2017-11-29 05:19:36 +00:00
return err
2017-11-15 06:59:43 +00:00
}
2017-11-23 09:34:07 +00:00
2017-11-29 05:19:36 +00:00
return nil
2017-11-15 06:59:43 +00:00
}
2017-11-29 05:19:36 +00:00
func (sh *ServerHandlers) OnStart(serverCTX server.ServerContext) {
2017-12-05 05:58:32 +00:00
sh.ServerHandler.OnStart(serverCTX)
2017-11-29 00:36:19 +00:00
2017-11-15 06:59:43 +00:00
}
2017-11-29 05:19:36 +00:00
func (sh *ServerHandlers) OnStop(serverCTX server.ServerContext) {
2017-11-23 09:34:07 +00:00
2017-12-05 05:58:32 +00:00
sh.ServerHandler.OnStop(serverCTX)
2017-11-01 06:35:03 +00:00
}
2017-10-26 13:18:20 +00:00
2018-03-27 09:51:48 +00:00
func (sh *ServerHandlers) Destroy(serverCTX server.ServerContext) {
sh.ServerHandler.Destroy(serverCTX)
}
2017-11-15 06:59:43 +00:00
func (sh *ServerHandlers) Validate() {
2017-12-05 05:58:32 +00:00
sh.ServerHandler.Validate()
2017-11-01 06:35:03 +00:00
2017-11-29 00:36:19 +00:00
}