rpc/protocol/client_codec.go
crusader 93cffbb1e5 ing
2017-11-01 18:58:16 +09:00

33 lines
719 B
Go

package protocol
import (
"io"
)
// ClientCodec creates a ClientCodecRequest to process each request.
type ClientCodec interface {
Write(w io.Writer, method string, args interface{}, id interface{}) error
NewResponseOrNotify(rc io.Reader) (ClientCodecResponseOrNotify, error)
}
// ClientCodecResponseOrNotify encodes a response or notify using a specific
// serialization scheme.
type ClientCodecResponseOrNotify interface {
IsResponse() bool
IsNotify() bool
GetResponse() ClientCodecResponse
GetNotify() ClientCodecNotify
Complete()
}
type ClientCodecResponse interface {
ID() interface{}
Result(result interface{}) error
Error() error
Complete()
}
type ClientCodecNotify interface {
RegistryCodec
}