2017-11-08 06:35:27 +00:00
|
|
|
package rpc
|
2017-11-01 07:25:29 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
|
|
|
|
"git.loafle.net/commons_go/rpc/protocol"
|
|
|
|
)
|
|
|
|
|
2017-11-08 06:35:27 +00:00
|
|
|
type ServerHandler interface {
|
2017-11-15 05:45:08 +00:00
|
|
|
Init() error
|
|
|
|
OnStart()
|
2017-11-01 07:25:29 +00:00
|
|
|
|
|
|
|
OnPreRead(r io.Reader)
|
|
|
|
OnPostRead(r io.Reader)
|
|
|
|
|
|
|
|
OnPreWriteResult(w io.Writer, result interface{})
|
|
|
|
OnPostWriteResult(w io.Writer, result interface{})
|
|
|
|
|
|
|
|
OnPreWriteError(w io.Writer, err error)
|
|
|
|
OnPostWriteError(w io.Writer, err error)
|
2017-11-15 05:45:08 +00:00
|
|
|
|
|
|
|
OnStop()
|
|
|
|
|
|
|
|
Validate()
|
|
|
|
|
|
|
|
RegisterCodec(codec protocol.ServerCodec, contentType string)
|
|
|
|
GetCodec(contentType string) (protocol.ServerCodec, error)
|
2017-11-01 07:25:29 +00:00
|
|
|
}
|