2018-04-03 08:58:26 +00:00
|
|
|
package protocol
|
|
|
|
|
|
|
|
// ServerCodec creates a ServerRequestCodec to process each request.
|
|
|
|
type ServerCodec interface {
|
|
|
|
NewRequest(buf []byte) (ServerRequestCodec, error)
|
2018-04-06 07:50:10 +00:00
|
|
|
NewRequestWithString(method string, params []string, id interface{}) (ServerRequestCodec, error)
|
2018-04-03 08:58:26 +00:00
|
|
|
NewNotification(method string, args []interface{}) ([]byte, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
// ServerRequestCodec decodes a request and encodes a response using a specific
|
|
|
|
// serialization scheme.
|
|
|
|
type ServerRequestCodec interface {
|
|
|
|
RegistryCodec
|
|
|
|
|
2018-04-05 04:54:34 +00:00
|
|
|
HasResponse() bool
|
2018-04-05 01:12:33 +00:00
|
|
|
NewResponse(reply interface{}, err error) ([]byte, error)
|
2018-04-06 10:04:59 +00:00
|
|
|
NewResponseWithString(reply string, err error) ([]byte, error)
|
2018-04-03 08:58:26 +00:00
|
|
|
}
|