33 lines
707 B
Go
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
|
||
|
}
|