17 lines
495 B
Go
17 lines
495 B
Go
|
package protocol
|
||
|
|
||
|
// ServerCodec creates a ServerRequestCodec to process each request.
|
||
|
type ServerCodec interface {
|
||
|
NewRequest(buf []byte) (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
|
||
|
|
||
|
NewResponse(reply interface{}) ([]byte, error)
|
||
|
NewError(status int, err error) ([]byte, error)
|
||
|
}
|