Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcceptConnection ¶
AcceptConnection completes the StreamRPC handshake on the server side. It notifies the client that the server has accepted the stream, and returns the connection.
func Call ¶
func Call(ctx context.Context, dial DialFunc, method string, msg proto.Message, callback func(net.Conn) error, opts ...CallOption) (err error)
Call makes a StreamRPC call. The dial function determines the remote address. The method argument is the full name of the StreamRPC method we are calling (e.g. "/foo.BarService/BazStream"). Msg is the request message. If the server accepts the call, callback is called with a connection.
Types ¶
type CallOption ¶
type CallOption func(*callOptions)
CallOption is an abstraction that lets us pass 0 or more options to a call.
func WithClientInterceptor ¶
func WithClientInterceptor(interceptor grpc.UnaryClientInterceptor) CallOption
WithClientInterceptor adds a gRPC unary client interceptor to an outgoing call.
func WithCredentials ¶
func WithCredentials(creds credentials.PerRPCCredentials) CallOption
WithCredentials adds gRPC per-request credentials to an outgoing call.
type DialFunc ¶
DialFunc is an abstraction that allows Call to transparently handle unencrypted connections and TLS connections.
type RequestRejectedError ¶
type RequestRejectedError struct {
// contains filtered or unexported fields
}
RequestRejectedError is returned by Call if the server explicitly rejected the request (as opposed to e.g. an IO timeout).
func (*RequestRejectedError) Error ¶
func (r *RequestRejectedError) Error() string
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server handles network connections and routes them to StreamRPC handlers.
func NewServer ¶
func NewServer(opts ...ServerOption) *Server
NewServer returns a new StreamRPC server. You can pass the result to grpc-go RegisterFooServer functions.
func (*Server) Handle ¶
Handle handles an incoming network connection with the StreamRPC protocol. It is intended to be called from a net.Listener.Accept loop (or something equivalent).
func (*Server) RegisterService ¶
func (s *Server) RegisterService(sd *grpc.ServiceDesc, impl interface{})
RegisterService implements grpc.ServiceRegistrar. It makes it possible to pass a *Server to grpc-go foopb.RegisterFooServer functions as the first argument.
type ServerOption ¶
type ServerOption func(*Server)
ServerOption is an abstraction that lets you pass 0 or more server options to NewServer.
func WithServerInterceptor ¶
func WithServerInterceptor(interceptor grpc.UnaryServerInterceptor) ServerOption
WithServerInterceptor adds a unary gRPC server interceptor.