internal

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: MIT 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

WithStreamClientInterceptors uses given client stream interceptors.

func WithStreamServerInterceptors

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

WithStreamServerInterceptors uses given server stream interceptors.

func WithUnaryClientInterceptors

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

WithUnaryClientInterceptors uses given client unary interceptors.

func WithUnaryServerInterceptors

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

WithUnaryServerInterceptors uses given server unary interceptors.

Types

type Client added in v1.1.5

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

Client interface wraps the Conn method.

func NewClient

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

NewClient returns a Client.

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 added in v1.2.3

func WithNonBlock() ClientOption

WithNonBlock sets the dialing to be nonblock.

func WithTimeout

func WithTimeout(timeout time.Duration) ClientOption

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

func WithTransportCredentials added in v1.2.3

func WithTransportCredentials(creds credentials.TransportCredentials) ClientOption

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

func WithUnaryClientInterceptor added in v1.0.22

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 NewRpcPubServer

func NewRpcPubServer(etcd discov.EtcdConf, listenOn string, opts ...ServerOption) (Server, error)

NewRpcPubServer returns a Server.

func NewRpcServer

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

NewRpcServer returns a Server.

type ServerOption

type ServerOption func(options *rpcServerOptions)

ServerOption defines the method to customize a rpcServerOptions.

func WithMetrics

func WithMetrics(metrics *stat.Metrics) ServerOption

WithMetrics returns a func that sets metrics to a Server.

Directories

Path Synopsis
balancer
p2c

Jump to

Keyboard shortcuts

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