Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Call ¶ added in v0.0.2
type Call struct {
ServiceMethod interface{}
Args interface{} // The argument to the function (*struct).
Reply interface{} // The reply from the function (*struct).
Error error // After completion, the error status.
Done chan *Call // Strobes when call is complete.
Context interface{}
// contains filtered or unexported fields
}
Call represents an active RPC.
type Client ¶
type Client interface {
Close() error
Go(serviceMethod, args interface{}, reply interface{}, done chan *Call) *Call
Call(serviceMethod, args interface{}, reply interface{}) error
Wait()
}
Client ...
func NewClientWithCodec ¶ added in v0.0.2
func NewClientWithCodec(codec ClientCodec) Client
NewClientWithCodec is like NewClient but uses the specified codec to encode requests and decode responses.
type ClientCodec ¶ added in v0.0.2
type ClientCodec interface {
GetSeq(req *Request) (seq interface{})
WriteRequest(req *Request, args interface{}) error
ReadResponseHeader(*Response) error
ReadResponseBody(resp *Response, reply interface{}) error
Close() error
}
A ClientCodec implements writing of RPC requests and reading of RPC responses for the p side of an RPC session. The p calls WriteRequest to write a request to the connection and calls ReadResponseHeader and ReadResponseBody in pairs to read responses. The p calls Close when finished with the connection. ReadResponseBody may be called with a nil argument to force the body of the response to be read and then discarded. See NewClient's comment for information about concurrent access.