Documentation
¶
Index ¶
Constants ¶
const (
SupportPackageIsVersion4 = true
)
The SupportPackageIsVersion variables are referenced from generated protocol buffer files to ensure compatibility with the gRPC version used. The latest support package version is 4.
Older versions are kept for compatibility. They may be removed if compatibility cannot be maintained.
These constants should not be referenced from any other code.
Note: grpc-wasm is compatible with Version4+ files only.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallOption ¶
type CallOption interface {
// contains filtered or unexported methods
}
CallOption configures a Call before it starts or extracts information from a Call after it completes.
type ClientConn ¶
type ClientConn struct {
// contains filtered or unexported fields
}
func Dial ¶
func Dial(target string, opts ...DialOption) (*ClientConn, error)
Dial creates a client connection to the target. The target string should be a URL with scheme HTTP or HTTPS, or a FQDN to infer the scheme.
func DialContext ¶
func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *ClientConn, err error)
func (*ClientConn) Invoke ¶
func (cc *ClientConn) Invoke(ctx context.Context, method string, args, reply interface{}, opts ...CallOption) error
func (*ClientConn) NewStream ¶
func (cc *ClientConn) NewStream(ctx context.Context, desc *StreamDesc, method string, opts ...CallOption) (ClientStream, error)
type ClientStream ¶
type ClientStream grpc.ClientStream
ClientStream defines the interface a client stream has to satisfy.
type DialOption ¶
type DialOption func(*dialOptions)
DialOption configures how we set up the connection.
type MethodDesc ¶
type MethodDesc struct { MethodName string Handler methodHandler }
MethodDesc represents an RPC service's method specification.
type Server ¶
type Server struct{}
Server is a gRPC server to serve RPC requests.
func (*Server) RegisterService ¶
func (s *Server) RegisterService(sd *ServiceDesc, ss interface{})
type ServerStream ¶
type ServerStream grpc.ServerStream
ServerStream defines the interface a server stream has to satisfy.
type ServiceDesc ¶
type ServiceDesc struct { ServiceName string // The pointer to the service interface. Used to check whether the user // provided implementation satisfies the interface requirements. HandlerType interface{} Methods []MethodDesc Streams []StreamDesc Metadata interface{} }
ServiceDesc represents an RPC service's specification.
type StreamDesc ¶
type StreamDesc struct { StreamName string Handler StreamHandler // At least one of these is true. ServerStreams bool ClientStreams bool }
StreamDesc represents a streaming RPC service's method specification.
type StreamHandler ¶
type StreamHandler func(srv interface{}, stream ServerStream) error
StreamHandler defines the handler called by gRPC server to complete the execution of a streaming RPC. If a StreamHandler returns an error, it should be produced by the status package, or else gRPC will use codes.Unknown as the status code and err.Error() as the status message of the RPC.
type UnaryHandler ¶
UnaryHandler defines the handler invoked by UnaryServerInterceptor to complete the normal execution of a unary RPC. If a UnaryHandler returns an error, it should be produced by the status package, or else gRPC will use codes.Unknown as the status code and err.Error() as the status message of the RPC.
type UnaryServerInfo ¶
type UnaryServerInfo struct { // Server is the service implementation the user provides. This is read-only. Server interface{} // FullMethod is the full RPC method string, i.e., /package.service/method. FullMethod string }
UnaryServerInfo consists of various information about a unary RPC on server side. All per-rpc information may be mutated by the interceptor.
type UnaryServerInterceptor ¶
type UnaryServerInterceptor func(ctx context.Context, req interface{}, info *UnaryServerInfo, handler UnaryHandler) (resp interface{}, err error)
UnaryServerInterceptor provides a hook to intercept the execution of a unary RPC on the server. info contains all the information of this RPC the interceptor can operate on. And handler is the wrapper of the service method implementation. It is the responsibility of the interceptor to invoke handler to complete the RPC.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
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. |
generator
The code generator for the plugin for the Google protocol buffer compiler.
|
The code generator for the plugin for the Google protocol buffer compiler. |
generator/internal/remap
Package remap handles tracking the locations of Go tokens in a source text across a rewrite by the Go formatter.
|
Package remap handles tracking the locations of Go tokens in a source text across a rewrite by the Go formatter. |
grpc
Package grpc outputs gRPC service descriptions in Go code.
|
Package grpc outputs gRPC service descriptions in Go code. |