rpcserver

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)

func DialInsecure

func DialInsecure(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)

DialInsecure 非安全拨号

func InitBuilder

func InitBuilder()

InitBuilder initializes the builder for the selector balancer. 初始化 grpc balancer

Types

type ClientOption

type ClientOption func(o *clientOptions)

func WithBalancerName

func WithBalancerName(name string) ClientOption

WithBalancerName 设置负载均衡器

func WithClientLogger

func WithClientLogger(logger log.Logger) ClientOption

WithClientLogger 设置日志

func WithClientOptions

func WithClientOptions(opts ...grpc.DialOption) ClientOption

WithClientOptions 设置grpc的dial选项

func WithClientStreamInterceptor

func WithClientStreamInterceptor(in ...grpc.StreamClientInterceptor) ClientOption

WithClientStreamInterceptor 设置stream拦截器

func WithClientTimeout

func WithClientTimeout(timeout time.Duration) ClientOption

WithClientTimeout 设置超时时间

func WithClientTracing

func WithClientTracing() ClientOption

WithClientTracing 设置链路追踪

func WithClientUnaryInterceptor

func WithClientUnaryInterceptor(in ...grpc.UnaryClientInterceptor) ClientOption

WithClientUnaryInterceptor 设置拦截器

func WithDiscovery

func WithDiscovery(d registry.Discovery) ClientOption

WithDiscovery 设置服务发现

func WithEndpoint

func WithEndpoint(endpoint string) ClientOption

WithEndpoint 设置服务端的地址

type Server

type Server struct {
	// 匿名字段,用于实现 grpc 注册 Server
	*grpc.Server
	// contains filtered or unexported fields
}

Server grpc 服务端结构体

func NewServer

func NewServer(opts ...ServerOption) *Server

func (*Server) Address

func (s *Server) Address() string

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

type ServerOption

type ServerOption func(o *Server)

func WithAddress

func WithAddress(address string) ServerOption

func WithEnableMetric

func WithEnableMetric(enable bool) ServerOption

func WithLis

func WithLis(lis net.Listener) ServerOption

func WithOptions

func WithOptions(opts ...grpc.ServerOption) ServerOption

func WithStreamInterceptor

func WithStreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption

func WithTimeout

func WithTimeout(timeout time.Duration) ServerOption

func WithUnaryInterceptor

func WithUnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption

type Trailer

type Trailer metadata.MD

Trailer is a grpc trailder MD.

func (Trailer) Get

func (t Trailer) Get(k string) string

Get get a grpc trailer value.

Directories

Path Synopsis
resolver
p2c
wrr

Jump to

Keyboard shortcuts

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