rpc/protocol/client_codec.go

33 lines
719 B
Go
Raw Normal View History

2017-10-31 09:25:44 +00:00
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{}
2017-11-01 09:58:16 +00:00
Result(result interface{}) error
2017-10-31 09:25:44 +00:00
Error() error
Complete()
}
type ClientCodecNotify interface {
RegistryCodec
}