probe/client/client-handler.go

57 lines
944 B
Go
Raw Normal View History

2018-05-03 11:24:07 +00:00
package client
import (
"sync/atomic"
crc "git.loafle.net/commons/rpc-go/client"
)
type ClientHandler interface {
crc.ClientHandler
}
type ClientHandlers struct {
crc.ClientHandlers
validated atomic.Value
}
func (ch *ClientHandlers) Init(clientCtx crc.ClientCtx) error {
if err := ch.ClientHandlers.Init(clientCtx); nil != err {
return err
}
return nil
}
func (ch *ClientHandlers) OnStart(clientCtx crc.ClientCtx) error {
if err := ch.ClientHandlers.OnStart(clientCtx); nil != err {
return err
}
return nil
}
func (ch *ClientHandlers) OnStop(clientCtx crc.ClientCtx) {
ch.ClientHandlers.OnStop(clientCtx)
}
func (ch *ClientHandlers) Destroy(clientCtx crc.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
}