29 lines
518 B
Go
29 lines
518 B
Go
package rpc
|
|
|
|
import (
|
|
"io"
|
|
|
|
"git.loafle.net/commons_go/rpc/protocol"
|
|
)
|
|
|
|
type ServerHandler interface {
|
|
Init() error
|
|
OnStart()
|
|
|
|
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)
|
|
|
|
OnStop()
|
|
|
|
Validate()
|
|
|
|
RegisterCodec(codec protocol.ServerCodec, contentType string)
|
|
GetCodec(contentType string) (protocol.ServerCodec, error)
|
|
}
|