Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Invoke ¶
func Invoke(ctx context.Context, method string, args, reply interface{}, cc *ClientConn) error
Invoke sends the RPC request on the wire and returns after response is received. Invoke is called by generated code. Also users can call Invoke directly when it is really needed in their use cases.
Types ¶
type ClientConn ¶
type ClientConn struct {
// contains filtered or unexported fields
}
ClientConn represents a client connection to an RPC server.
func Dial ¶
func Dial(ctx context.Context, addr string) (*ClientConn, error)
Dial creates a client connection to the given target. The provided Context must be non-nil. If the context expires before the connection is complete, an error is returned. Once successfully connected, any expiration of the context will not affect the connection.
func NewClientConn ¶
func NewClientConn(conn net.Conn) *ClientConn
NewClientConn creates a ClientConn on a given connection
func (*ClientConn) Close ¶
func (c *ClientConn) Close() error
Close tears down the ClientConn and all underlying connections.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a pbrpc server to serve RPC requests.
func NewServer ¶
func NewServer() *Server
NewServer creates a pbrpc server which has no service registered and has not started to accept requests yet.
func (*Server) RegisterService ¶
RegisterService register a service and its implementation to the pbrpc server. Called from the IDL generated code. This must be called before invoking Serve.
func (*Server) Serve ¶
Serve accepts incoming connections on the listener l, creating a new ServerConn and service goroutine for each. The service goroutines read pbrpc requests and then call the registered handlers to reply to them. Serve returns when l.Accept fails with errors. TODO Handle non fatal errors
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
echo/echo
Package echo is a generated protocol buffer package.
|
Package echo is a generated protocol buffer package. |
protoc-gen-go is a plugin for the Google protocol buffer compiler to generate Go code.
|
protoc-gen-go is a plugin for the Google protocol buffer compiler to generate Go code. |
pbrpc
Package pbrpc outputs sofa-pbrpc service descriptions in Go code.
|
Package pbrpc outputs sofa-pbrpc service descriptions in Go code. |
Package meta is a generated protocol buffer package.
|
Package meta is a generated protocol buffer package. |