rpc/protocol/client_codec.go
crusader 8e43174376 ing
2017-10-31 18:25:44 +09:00

33 lines
707 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() interface{}
Error() error
Complete()
}
type ClientCodecNotify interface {
RegistryCodec
}