rpc-go/protocol/server_codec.go
crusader 5f64fccd7c ing
2018-04-06 19:04:59 +09:00

19 lines
639 B
Go

package protocol
// ServerCodec creates a ServerRequestCodec to process each request.
type ServerCodec interface {
NewRequest(buf []byte) (ServerRequestCodec, error)
NewRequestWithString(method string, params []string, id interface{}) (ServerRequestCodec, error)
NewNotification(method string, args []interface{}) ([]byte, error)
}
// ServerRequestCodec decodes a request and encodes a response using a specific
// serialization scheme.
type ServerRequestCodec interface {
RegistryCodec
HasResponse() bool
NewResponse(reply interface{}, err error) ([]byte, error)
NewResponseWithString(reply string, err error) ([]byte, error)
}