22 lines
549 B
Go
22 lines
549 B
Go
package protocol
|
|
|
|
import (
|
|
"io"
|
|
)
|
|
|
|
// ServerCodec creates a ServerRequestCodec to process each request.
|
|
type ServerCodec interface {
|
|
NewRequest(r io.Reader) (ServerRequestCodec, error)
|
|
WriteNotification(w io.Writer, method string, args []interface{}) error
|
|
}
|
|
|
|
// ServerRequestCodec decodes a request and encodes a response using a specific
|
|
// serialization scheme.
|
|
type ServerRequestCodec interface {
|
|
RegistryCodec
|
|
|
|
HasResponse() bool
|
|
WriteResponse(w io.Writer, reply interface{}) error
|
|
WriteError(w io.Writer, status int, err error) error
|
|
}
|