internal

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLogger

func InitLogger()

InitLogger initializes the rpc logger.

func WithStreamClientInterceptors

func WithStreamClientInterceptors(interceptors ...grpc.StreamClientInterceptor) grpc.DialOption

func WithStreamServerInterceptors

func WithStreamServerInterceptors(interceptors ...grpc.StreamServerInterceptor) grpc.ServerOption

func WithUnaryClientInterceptors

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

func WithUnaryServerInterceptors

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

Types

type Client

type Client interface {
	Conn() *grpc.ClientConn
}

Client interface wraps the Conn method.

func NewClient

func NewClient(target string, opts ...ClientOption) (Client, error)

type ClientOption

type ClientOption func(options *ClientOptions)

ClientOption defines the method to customize a ClientOptions.

func WithDialOption

func WithDialOption(opt grpc.DialOption) ClientOption

WithDialOption returns a func to customize a ClientOptions with given dial option.

func WithNonBlock

func WithNonBlock() ClientOption

WithNonBlock sets the dialing to be nonblock.

func WithStreamClientInterceptor

func WithStreamClientInterceptor(interceptor grpc.StreamClientInterceptor) ClientOption

WithStreamClientInterceptor returns func to customize a ClientOptions with given interceptor.

func WithTimeout

func WithTimeout(timeout time.Duration) ClientOption

WithTimeout returns a func to customize a ClientOptions with given timeout.

func WithTransportCredentials

func WithTransportCredentials(creds credentials.TransportCredentials) ClientOption

WithTransportCredentials return a func to make the gRPC calls secured with given credentials.

func WithUnaryClientInterceptor

func WithUnaryClientInterceptor(interceptor grpc.UnaryClientInterceptor) ClientOption

WithUnaryClientInterceptor returns a func to customize a ClientOptions with given interceptor.

type ClientOptions

type ClientOptions struct {
	NonBlock    bool
	Timeout     time.Duration
	Secure      bool
	DialOptions []grpc.DialOption
}

A ClientOptions is a client options.

type Logger

type Logger struct{}

A Logger is a rpc logger.

func (*Logger) Error

func (l *Logger) Error(args ...interface{})

Error logs the given args into error log.

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...interface{})

Errorf logs the given args with format into error log.

func (*Logger) Errorln

func (l *Logger) Errorln(args ...interface{})

Errorln logs the given args into error log with newline.

func (*Logger) Fatal

func (l *Logger) Fatal(args ...interface{})

Fatal logs the given args into error log.

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, args ...interface{})

Fatalf logs the given args with format into error log.

func (*Logger) Fatalln

func (l *Logger) Fatalln(args ...interface{})

Fatalln logs args into error log with newline.

func (*Logger) Info

func (l *Logger) Info(args ...interface{})

Info ignores the grpc info logs.

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...interface{})

Infof ignores the grpc info logs.

func (*Logger) Infoln

func (l *Logger) Infoln(args ...interface{})

Infoln ignores the grpc info logs.

func (*Logger) V

func (l *Logger) V(v int) bool

V checks if meet required log level.

func (*Logger) Warning

func (l *Logger) Warning(args ...interface{})

Warning ignores the grpc warning logs.

func (*Logger) Warningf

func (l *Logger) Warningf(format string, args ...interface{})

Warningf ignores the grpc warning logs.

func (*Logger) Warningln

func (l *Logger) Warningln(args ...interface{})

Warningln ignores the grpc warning logs.

type RegisterFn

type RegisterFn func(*grpc.Server)

RegisterFn defines the method to register a server.

type Server

type Server interface {
	AddOptions(options ...grpc.ServerOption)
	AddStreamInterceptors(interceptors ...grpc.StreamServerInterceptor)
	AddUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor)
	SetName(string)
	Start(register RegisterFn) error
}

Server interface represents a rpc server.

func NewRpcServer

func NewRpcServer(address string, opts ...ServerOption) Server

type ServerOption

type ServerOption func(options *rpcServerOptions)

func WithMetrics

func WithMetrics(metrics *stat.Metrics) ServerOption

Directories

Path Synopsis
balancer
p2c

Jump to

Keyboard shortcuts

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