container_discovery/client/client-handler.go
crusader 2199c4b37f ing
2018-07-01 15:41:35 +09:00

58 lines
1010 B
Go

package client
import (
"sync/atomic"
cssc "git.loafle.net/commons/server-go/socket/client"
occ "git.loafle.net/overflow/container-go/client"
)
type ClientHandler interface {
occ.ClientHandler
}
type ClientHandlers struct {
occ.ClientHandlers
validated atomic.Value
}
func (ch *ClientHandlers) Init(clientCtx cssc.ClientCtx) error {
if err := ch.ClientHandlers.Init(clientCtx); nil != err {
return err
}
return nil
}
func (ch *ClientHandlers) OnStart(clientCtx cssc.ClientCtx) error {
if err := ch.ClientHandlers.OnStart(clientCtx); nil != err {
return err
}
return nil
}
func (ch *ClientHandlers) OnStop(clientCtx cssc.ClientCtx) {
ch.ClientHandlers.OnStop(clientCtx)
}
func (ch *ClientHandlers) Destroy(clientCtx cssc.ClientCtx) {
ch.ClientHandlers.Destroy(clientCtx)
}
func (ch *ClientHandlers) Validate() error {
if nil != ch.validated.Load() {
return nil
}
ch.validated.Store(true)
if err := ch.ClientHandlers.Validate(); nil != err {
return err
}
return nil
}