Documentation ¶
Overview ¶
Package grpc implements grpc rpc protocol.
Index ¶
Constants ¶
const (
// GRPC module name
GRPC = "grpc"
)
Variables ¶
This section is empty.
Functions ¶
func GetProtocol ¶
GetProtocol gets gRPC protocol, will create if null.
Types ¶
type Client ¶
type Client struct { *grpc.ClientConn // contains filtered or unexported fields }
Client is gRPC client include client connection and invoker
type ClientConfig ¶
type ClientConfig struct { // content type, more information refer by https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests ContentSubType string `default:"proto" yaml:"content_sub_type" json:"content_sub_type,omitempty"` }
ClientConfig wrap client call parameters
func GetClientConfig ¶
func GetClientConfig() ClientConfig
GetClientConfig return grpc client custom call options
func GetDefaultClientConfig ¶
func GetDefaultClientConfig() ClientConfig
GetDefaultClientConfig return grpc client default call options
func (*ClientConfig) Validate ¶
func (c *ClientConfig) Validate() error
Validate check if custom config encoding is supported in dubbo grpc
type DubboGrpcService ¶
type DubboGrpcService interface { // SetProxyImpl sets proxy. SetProxyImpl(impl protocol.Invoker) // GetProxyImpl gets proxy. GetProxyImpl() protocol.Invoker // ServiceDesc gets an RPC service's specification. ServiceDesc() *grpc.ServiceDesc }
DubboGrpcService is gRPC service
type GrpcExporter ¶
type GrpcExporter struct {
*protocol.BaseExporter
}
nolint
func NewGrpcExporter ¶
NewGrpcExporter creates a new gRPC exporter
func (*GrpcExporter) UnExport ¶ added in v3.0.4
func (gg *GrpcExporter) UnExport()
Unexport and unregister gRPC service from registry and memory.
type GrpcInvoker ¶
type GrpcInvoker struct { protocol.BaseInvoker // contains filtered or unexported fields }
nolint
func NewGrpcInvoker ¶
func NewGrpcInvoker(url *common.URL, client *Client) *GrpcInvoker
NewGrpcInvoker returns a Grpc invoker instance
func (*GrpcInvoker) Destroy ¶
func (gi *GrpcInvoker) Destroy()
Destroy will destroy gRPC's invoker and client, so it is only called once
func (*GrpcInvoker) Invoke ¶
func (gi *GrpcInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result
Invoke is used to call service method by invocation
func (*GrpcInvoker) IsAvailable ¶
func (gi *GrpcInvoker) IsAvailable() bool
IsAvailable get available status
func (*GrpcInvoker) IsDestroyed ¶
func (gi *GrpcInvoker) IsDestroyed() bool
IsDestroyed get destroyed status
type GrpcProtocol ¶
type GrpcProtocol struct { protocol.BaseProtocol // contains filtered or unexported fields }
GrpcProtocol is gRPC protocol
func NewGRPCProtocol ¶
func NewGRPCProtocol() *GrpcProtocol
NewGRPCProtocol creates new gRPC protocol
func (*GrpcProtocol) Destroy ¶
func (gp *GrpcProtocol) Destroy()
Destroy will destroy gRPC all invoker and exporter, so it only is called once.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a gRPC server
func (*Server) GracefulStop ¶ added in v3.0.1
func (s *Server) GracefulStop()
GracefulStop gRPC server
func (*Server) SetBufferSize ¶
type ServerConfig ¶
type ServerConfig struct{}
ServerConfig currently is empty struct,for future expansion
func GetDefaultServerConfig ¶
func GetDefaultServerConfig() ServerConfig
GetDefaultServerConfig currently return empty struct,for future expansion
func (*ServerConfig) Validate ¶
func (c *ServerConfig) Validate() error
Validate currently return empty struct,for future expansion