rpc/protocol/server_codec.go

21 lines
527 B
Go
Raw Normal View History

2017-10-31 18:25:44 +09:00
package protocol
import (
"io"
)
2017-11-26 19:15:51 +09:00
// ServerCodec creates a ServerRequestCodec to process each request.
2017-10-31 18:25:44 +09:00
type ServerCodec interface {
2017-11-26 19:15:51 +09:00
NewRequest(r io.Reader) (ServerRequestCodec, error)
WriteNotification(w io.Writer, method string, args interface{}) error
2017-10-31 18:25:44 +09:00
}
2017-11-26 19:15:51 +09:00
// ServerRequestCodec decodes a request and encodes a response using a specific
2017-10-31 18:25:44 +09:00
// serialization scheme.
2017-11-26 19:15:51 +09:00
type ServerRequestCodec interface {
2017-10-31 18:25:44 +09:00
RegistryCodec
2017-11-29 01:19:03 +09:00
2017-10-31 18:25:44 +09:00
WriteResponse(w io.Writer, reply interface{}) error
WriteError(w io.Writer, status int, err error) error
}