rpc/protocol/server_codec.go

17 lines
495 B
Go
Raw Normal View History

2017-10-31 09:25:44 +00:00
package protocol
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 {
2018-03-23 17:26:41 +00:00
NewRequest(buf []byte) (ServerRequestCodec, error)
NewNotification(method string, args []interface{}) ([]byte, 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
2018-03-23 17:26:41 +00:00
NewResponse(reply interface{}) ([]byte, error)
NewError(status int, err error) ([]byte, error)
2017-10-31 09:25:44 +00:00
}