overflow_discovery/server/server_handlers.go

45 lines
958 B
Go
Raw Normal View History

2017-10-26 12:55:55 +00:00
package server
import (
2017-11-15 06:59:43 +00:00
"git.loafle.net/commons_go/server"
2017-12-05 05:58:32 +00:00
"git.loafle.net/overflow/overflow_discovery/discovery"
oopcs "git.loafle.net/overflow/overflow_probe_container/server"
2017-10-26 12:55:55 +00:00
)
2017-12-14 08:55:57 +00:00
func newServerHandler(pidPath string, socketHandler SocketHandler) ServerHandler {
2017-12-05 05:58:32 +00:00
sh := &ServerHandlers{}
2017-12-14 08:55:57 +00:00
sh.ServerHandler = oopcs.NewServerHandler(pidPath, "Discovery Containter", socketHandler)
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-29 05:19:36 +00:00
discovery.DiscoveryInit()
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-11-15 12:09:38 +00:00
discovery.DiscoveryDestroy()
2017-11-29 05:19:36 +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
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
}