rpc-go/protocol/server_codec.go
crusader 32883be22b ing
2018-07-01 01:37:26 +09:00

19 lines
760 B
Go

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