rpc/protocol/server_codec.go

21 lines
529 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)
2018-03-20 06:31:54 +00:00
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
2017-11-28 16:19:03 +00:00
2017-10-31 09:25:44 +00:00
WriteResponse(w io.Writer, reply interface{}) error
WriteError(w io.Writer, status int, err error) error
}