overflow_discovery/server/rpc_server_handlers.go
crusader 1f366db739 ing
2017-11-01 19:05:50 +09:00

53 lines
986 B
Go

package server
import (
"io"
"git.loafle.net/commons_go/rpc"
"git.loafle.net/commons_go/rpc/protocol/json"
"git.loafle.net/commons_go/rpc/server"
)
func NewRPCServerHandler(registry rpc.Registry) *RPCServerHandlers {
rpcSH := &RPCServerHandlers{}
rpcSH.RPCRegistry = registry
rpcSH.RegisterCodec(json.NewServerCodec(), "json")
return rpcSH
}
type RPCServerHandlers struct {
server.RPCServerHandlers
addr string
}
func (sh *ServerHandlers) GetContentType(r io.Reader) string {
return "json"
}
func (sh *ServerHandlers) OnPreRead(r io.Reader) {
// no op
}
func (sh *ServerHandlers) OnPostRead(r io.Reader) {
// no op
}
func (sh *ServerHandlers) OnPreWriteResult(w io.Writer, result interface{}) {
// no op
}
func (sh *ServerHandlers) OnPostWriteResult(w io.Writer, result interface{}) {
// no op
}
func (sh *ServerHandlers) OnPreWriteError(w io.Writer, err error) {
// no op
}
func (sh *ServerHandlers) OnPostWriteError(w io.Writer, err error) {
// no op
}