zrpc

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

README

zrpc

倍通内部rpc框架,基于gRPC

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BalancerOption

func BalancerOption() grpc.DialOption

func Block

func Block() grpc.DialOption

func Insecure

func Insecure() grpc.DialOption

func WithDiscovery

func WithDiscovery(discoverer register.IDiscovery) grpc.DialOption

WithDiscovery 注册非全局的服务发现,此优先级高于全局注册

func WithUnaryClientInterceptors

func WithUnaryClientInterceptors(interceptors ...grpc.UnaryClientInterceptor) grpc.DialOption

WithUnaryClientInterceptors 按顺序加载拦截器 WithChainUnaryInterceptor 是一个按照顺序来的 WithUnaryInterceptor 总是在最前面

func WithUnaryServerInterceptors

func WithUnaryServerInterceptors(interceptors ...grpc.UnaryServerInterceptor) grpc.ServerOption

Types

type COption

type COption func(*[]grpc.DialOption)

func WithDialOption

func WithDialOption(opts ...grpc.DialOption) COption

type Client

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

func (*Client) Coon

func (c *Client) Coon() *grpc.ClientConn

type IClient

type IClient interface {
	Coon() *grpc.ClientConn
}

func MustNewClient

func MustNewClient(rpcClient rpc.Client, serverName string, opts ...grpc.DialOption) IClient

MustNewClient 新建一个 Client 实例

type RegisterServer

type RegisterServer func(server *grpc.Server)

type SOption

type SOption func(*[]grpc.ServerOption)

func WithServerOption

func WithServerOption(opts ...grpc.ServerOption) SOption

type Server

type Server struct {
	ServiceInstance *register.ServiceInstance
	// contains filtered or unexported fields
}

func MustNewServer

func MustNewServer(ctx context.Context, server rpc.Server, registerServer RegisterServer, serverOption ...grpc.ServerOption) *Server

func (*Server) BuildServerOption

func (s *Server) BuildServerOption() grpc.ServerOption

BuildServerOption 构建服务端拦截器

func (*Server) Serve

func (s *Server) Serve() error

Serve 启动服务

func (*Server) StopServe

func (s *Server) StopServe()

StopServe 停止服务

Jump to

Keyboard shortcuts

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