2017-11-01 10:05:50 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
|
|
|
|
"git.loafle.net/commons_go/rpc"
|
|
|
|
"git.loafle.net/commons_go/rpc/server"
|
|
|
|
)
|
|
|
|
|
2017-11-15 06:59:43 +00:00
|
|
|
func newRPCServerHandler(rpcRegistry rpc.Registry) server.ServerHandler {
|
|
|
|
sh := &RPCServerHandlers{}
|
|
|
|
sh.RPCRegistry = rpcRegistry
|
2017-11-01 10:05:50 +00:00
|
|
|
|
2017-11-15 06:59:43 +00:00
|
|
|
return sh
|
2017-11-01 10:05:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type RPCServerHandlers struct {
|
2017-11-15 06:59:43 +00:00
|
|
|
server.ServerHandlers
|
|
|
|
}
|
|
|
|
|
|
|
|
func (sh *RPCServerHandlers) Init() error {
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
2017-11-01 10:05:50 +00:00
|
|
|
|
2017-11-15 06:59:43 +00:00
|
|
|
func (sh *RPCServerHandlers) OnStart() {
|
|
|
|
// no op
|
2017-11-01 10:05:50 +00:00
|
|
|
}
|
|
|
|
|
2017-11-15 06:59:43 +00:00
|
|
|
func (sh *RPCServerHandlers) OnPreRead(r io.Reader) {
|
|
|
|
// no op
|
2017-11-01 10:05:50 +00:00
|
|
|
}
|
|
|
|
|
2017-11-15 06:59:43 +00:00
|
|
|
func (sh *RPCServerHandlers) OnPostRead(r io.Reader) {
|
2017-11-01 10:05:50 +00:00
|
|
|
// no op
|
|
|
|
}
|
|
|
|
|
2017-11-15 06:59:43 +00:00
|
|
|
func (sh *RPCServerHandlers) OnPreWriteResult(w io.Writer, result interface{}) {
|
2017-11-01 10:05:50 +00:00
|
|
|
// no op
|
|
|
|
}
|
|
|
|
|
2017-11-15 06:59:43 +00:00
|
|
|
func (sh *RPCServerHandlers) OnPostWriteResult(w io.Writer, result interface{}) {
|
2017-11-01 10:05:50 +00:00
|
|
|
// no op
|
|
|
|
}
|
|
|
|
|
2017-11-15 06:59:43 +00:00
|
|
|
func (sh *RPCServerHandlers) OnPreWriteError(w io.Writer, err error) {
|
2017-11-01 10:05:50 +00:00
|
|
|
// no op
|
|
|
|
}
|
|
|
|
|
2017-11-15 06:59:43 +00:00
|
|
|
func (sh *RPCServerHandlers) OnPostWriteError(w io.Writer, err error) {
|
2017-11-01 10:05:50 +00:00
|
|
|
// no op
|
|
|
|
}
|
|
|
|
|
2017-11-15 06:59:43 +00:00
|
|
|
func (sh *RPCServerHandlers) OnStop() {
|
2017-11-01 10:05:50 +00:00
|
|
|
// no op
|
|
|
|
}
|
2017-11-15 06:59:43 +00:00
|
|
|
|
|
|
|
func (sh *RPCServerHandlers) Validate() {
|
|
|
|
sh.ServerHandlers.Validate()
|
|
|
|
|
|
|
|
}
|