grpc

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientStubs

func ClientStubs(stubsFunc func(ctx context.Context, method string, req, reply interface{},
	cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error) func(ctx context.Context,
	method string, req, reply interface{}, cc *grpc.ClientConn,
	invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error

func ServerStubs

func ServerStubs(stubsFunc func(
	ctx context.Context,
	req interface{},
	info *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler,
) (resp interface{}, err error)) grpc.UnaryServerInterceptor

Types

type ClientConn

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

Collect the grpc.ClientConn instances

func NewClientConn

func NewClientConn(logger log.Logger) *ClientConn

func (*ClientConn) Close

func (this *ClientConn) Close()

Close unity closes the grpc.ClientConn instances

func (*ClientConn) CollectConn

func (this *ClientConn) CollectConn(conn *grpc.ClientConn)

Examples:

client := grpc.NewClient(clientOptions)
ctx := context.Background()
conn := client.DialContext(ctx, ":50051")

clientConn := NewClientConn()
clientConn.CollectConn(conn)

func (*ClientConn) State

func (this *ClientConn) State() []string

State unity show the grpc.ClientConn state

type ClientOptional

type ClientOptional func(c *ClientOptions)

type ClientOptionals

type ClientOptionals struct{}

func (ClientOptionals) WithConf

func (ClientOptionals) WithDialOptions

func (ClientOptionals) WithDialOptions(options ...grpc.DialOption) ClientOptional

func (ClientOptionals) WithLogger

func (ClientOptionals) WithLogger(logger log.Logger) ClientOptional

func (ClientOptionals) WithMetrics

func (ClientOptionals) WithMetrics(metrics *ggp.ClientMetrics) ClientOptional

func (ClientOptionals) WithTracer

type ClientOptions

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

func NewClientOptions

func NewClientOptions(options ...ClientOptional) *ClientOptions

type ClientState

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

type GrpcClient

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

func NewClient

func NewClient(clientOptions *ClientOptions) *GrpcClient

NewGrpcClient create GrpcClient for business. clientOptions clientOptions can not nil

func (*GrpcClient) Close

func (this *GrpcClient) Close()

func (*GrpcClient) DialContext

func (this *GrpcClient) DialContext(ctx context.Context, target string) *grpc.ClientConn

type GrpcServer

type GrpcServer struct {
	Server *grpc.Server
	// contains filtered or unexported fields
}

func NewGrpcServer

func NewGrpcServer(target string, options ...ServerOption) *GrpcServer

func (*GrpcServer) GracefulShutDown

func (this *GrpcServer) GracefulShutDown()

func (*GrpcServer) Start

func (this *GrpcServer) Start()

type ServerOption

type ServerOption func(c *GrpcServer)

type ServerOptions

type ServerOptions struct{}

func (ServerOptions) WithGrpcServerOption

func (ServerOptions) WithGrpcServerOption(options ...grpc.ServerOption) ServerOption

func (ServerOptions) WithServerConf

func (ServerOptions) WithServerConf(conf config.Config) ServerOption

func (ServerOptions) WithServerLogger

func (ServerOptions) WithServerLogger(logger log.Logger) ServerOption

func (ServerOptions) WithTracer

func (ServerOptions) WithTracer(tracer opentracing2.Tracer) ServerOption

func (ServerOptions) WithUnarySrvItcp

func (ServerOptions) WithUnarySrvItcp(options ...grpc.UnaryServerInterceptor) ServerOption

Jump to

Keyboard shortcuts

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