rpc/protocol/server_codec.go
crusader 08688dfb2f ing
2018-03-23 16:43:05 +09:00

23 lines
575 B
Go

package protocol
import (
"io"
)
// ServerCodec creates a ServerRequestCodec to process each request.
type ServerCodec interface {
NewDecoder(r io.Reader) interface{}
NewRequest(decoder interface{}) (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
WriteResponse(w io.Writer, reply interface{}) error
WriteError(w io.Writer, status int, err error) error
}