Documentation ¶
Index ¶
- Constants
- Variables
- func NewPbClientCodec(conn io.ReadWriteCloser) *pbClientCodec
- func NewPbServerCode(conn io.ReadWriteCloser) *pbServerCodec
- type Call
- type Client
- type ClientCodec
- type DialOption
- type RPCServer
- type Request
- type RequestHeader
- type Response
- type ResponseHeader
- type ServerCodec
- type ServerError
- type SugarCoatingRequest
- type SugarCoatingResponse
- type SugarCoatingResponseInterface
Constants ¶
const (
RpcdSourceGrowerGateway = "grower-gateway"
)
Variables ¶
var ErrShutdown = errors.New("connection is shut down")
Functions ¶
func NewPbClientCodec ¶
func NewPbClientCodec(conn io.ReadWriteCloser) *pbClientCodec
func NewPbServerCode ¶
func NewPbServerCode(conn io.ReadWriteCloser) *pbServerCodec
Types ¶
type Call ¶
type Call struct { ServiceMethod string // The name of the service and method to call. 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 // Receives *Call when Go is complete. }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithCodec ¶
func NewClientWithCodec(codec ClientCodec) *Client
func (*Client) Call ¶
Call invokes the named function, waits for it to complete, and returns its error status.
func (*Client) ClosedOrShutdowned ¶
type ClientCodec ¶
type DialOption ¶
type DialOption interface {
// contains filtered or unexported methods
}
func WithTimeout ¶
func WithTimeout(seconds time.Duration) DialOption
type RPCServer ¶
type RPCServer struct {
// contains filtered or unexported fields
}
func NewRPCServer ¶
func NewRPCServer() *RPCServer
func (*RPCServer) RegisterName ¶
func (server *RPCServer) RegisterName(name string, rcvr interface{}, routes map[string]string) error
RegisterName is like Register but uses the provided name for the type instead of the receiver's concrete type.
func (*RPCServer) ServeCodec ¶
func (server *RPCServer) ServeCodec(codec ServerCodec)
ServeCodec is like ServeConn but uses the specified codec to decode requests and encode responses.
func (*RPCServer) ServeRequest ¶
func (server *RPCServer) ServeRequest(codec ServerCodec) error
ServeRequest is like ServeCodec but synchronously serves a single request. It does not close the codec upon completion.
func (*RPCServer) ServeWithPbCodec ¶
type Request ¶
type Request struct { ServiceMethod string // format: "Service.Method" Seq uint64 // sequence number chosen by client // contains filtered or unexported fields }
Request is a header written before every RPC call. It is used internally but documented here as an aid to debugging, such as when analyzing network traffic.
type RequestHeader ¶
type RequestHeader struct { Id uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` Method string `protobuf:"bytes,2,opt,name=method" json:"method,omitempty"` RpcdSource string `protobuf:"bytes,3,opt,name=rpcdSource" json:"rpcdSource,omitempty"` Checksum uint32 `protobuf:"varint,5,opt,name=checksum" json:"checksum,omitempty"` }
func (*RequestHeader) Check ¶
func (m *RequestHeader) Check(body []byte) error
func (*RequestHeader) ProtoMessage ¶
func (*RequestHeader) ProtoMessage()
func (*RequestHeader) Reset ¶
func (m *RequestHeader) Reset()
func (*RequestHeader) String ¶
func (m *RequestHeader) String() string
type Response ¶
type Response struct { ServiceMethod string // echoes that of the Request Seq uint64 // echoes that of the request Error string // error, if any. // contains filtered or unexported fields }
Response is a header written before every RPC return. It is used internally but documented here as an aid to debugging, such as when analyzing network traffic.
type ResponseHeader ¶
type ResponseHeader struct { Id uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` Error string `protobuf:"bytes,2,opt,name=error" json:"error,omitempty"` Method string `protobuf:"bytes,2,opt,name=method" json:"method,omitempty"` Checksum uint32 `protobuf:"varint,5,opt,name=checksum" json:"checksum,omitempty"` }
func (*ResponseHeader) Check ¶
func (m *ResponseHeader) Check(body []byte) error
func (*ResponseHeader) ProtoMessage ¶
func (*ResponseHeader) ProtoMessage()
func (*ResponseHeader) Reset ¶
func (m *ResponseHeader) Reset()
func (*ResponseHeader) String ¶
func (m *ResponseHeader) String() string
type ServerCodec ¶
type ServerError ¶
type ServerError string
ServerError represents an error that has been returned from the remote side of the RPC connection.
func (ServerError) Error ¶
func (e ServerError) Error() string
type SugarCoatingRequest ¶
type SugarCoatingRequest struct { RpcdSource string `protobuf:"bytes,1,opt,name=RpcdSource" json:"RpcdSource,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"` }
func GenSugarCoatingRequest ¶
func GenSugarCoatingRequest(source string, data []byte) *SugarCoatingRequest
func (*SugarCoatingRequest) ProtoMessage ¶
func (*SugarCoatingRequest) ProtoMessage()
func (*SugarCoatingRequest) Reset ¶
func (m *SugarCoatingRequest) Reset()
func (*SugarCoatingRequest) String ¶
func (m *SugarCoatingRequest) String() string
type SugarCoatingResponse ¶
type SugarCoatingResponse struct {
Data []byte `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
}
func (*SugarCoatingResponse) GetSugarData ¶
func (m *SugarCoatingResponse) GetSugarData() ([]byte, error)
func (*SugarCoatingResponse) ProtoMessage ¶
func (*SugarCoatingResponse) ProtoMessage()
func (*SugarCoatingResponse) Reset ¶
func (m *SugarCoatingResponse) Reset()
func (*SugarCoatingResponse) String ¶
func (m *SugarCoatingResponse) String() string