grpc

package
v1.5.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GRPC module name
	GRPC = "grpc"
)

Variables

This section is empty.

Functions

func GetProtocol

func GetProtocol() protocol.Protocol

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

func NewClient

func NewClient(url *common.URL) (*Client, error)

NewClient creates a new gRPC client.

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

func NewGrpcExporter(key string, invoker protocol.Invoker, exporterMap *sync.Map) *GrpcExporter

NewGrpcExporter creates a new gRPC exporter

func (*GrpcExporter) Unexport

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.

func (*GrpcProtocol) Export

func (gp *GrpcProtocol) Export(invoker protocol.Invoker) protocol.Exporter

Export gRPC service for remote invocation

func (*GrpcProtocol) Refer

func (gp *GrpcProtocol) Refer(url *common.URL) protocol.Invoker

Refer a remote gRPC service

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is a gRPC server

func NewServer

func NewServer() *Server

NewServer creates a new server

func (*Server) GracefulStop

func (s *Server) GracefulStop()

GracefulStop gRPC server

func (*Server) SetBufferSize

func (s *Server) SetBufferSize(n int)

func (*Server) Start

func (s *Server) Start(url *common.URL)

Start gRPC server with @url

func (*Server) Stop

func (s *Server) Stop()

Stop gRPC server

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

Directories

Path Synopsis
protoc-gen-dubbo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL