rpc/protocol/server_codec.go

20 lines
526 B
Go
Raw Normal View History

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