Documentation ¶
Index ¶
- func BuildDirectTarget(endpoints []string) string
- func BuildDiscovTarget(endpoints []string, key string) string
- func InitLogger()
- func WithStreamClientInterceptors(interceptors ...grpc.StreamClientInterceptor) grpc.DialOption
- func WithStreamServerInterceptors(interceptors ...grpc.StreamServerInterceptor) grpc.ServerOption
- func WithUnaryClientInterceptors(interceptors ...grpc.UnaryClientInterceptor) grpc.DialOption
- func WithUnaryServerInterceptors(interceptors ...grpc.UnaryServerInterceptor) grpc.ServerOption
- type Client
- type ClientOption
- type ClientOptions
- type Logger
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Errorln(args ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) Fatalln(args ...interface{})
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Infoln(args ...interface{})
- func (l *Logger) V(v int) bool
- func (l *Logger) Warning(args ...interface{})
- func (l *Logger) Warningf(format string, args ...interface{})
- func (l *Logger) Warningln(args ...interface{})
- type RegisterFn
- type Server
- type ServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildDirectTarget ¶
BuildDirectTarget returns a string that represents the given endpoints with direct schema.
func BuildDiscovTarget ¶
BuildDiscovTarget returns a string that represents the given endpoints with discov schema.
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 ¶
type Client interface {
Conn() *grpc.ClientConn
}
Client interface wraps the Conn method.
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 WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout returns a func to customize a ClientOptions with given timeout.
func WithUnaryClientInterceptor ¶
func WithUnaryClientInterceptor(interceptor grpc.UnaryClientInterceptor) ClientOption
WithUnaryClientInterceptor returns a func to customize a ClientOptions with given interceptor.
type ClientOptions ¶
type ClientOptions struct { Timeout time.Duration 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) 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) Fatalln ¶
func (l *Logger) Fatalln(args ...interface{})
Fatalln logs args into error log with newline.
func (*Logger) Infoln ¶
func (l *Logger) Infoln(args ...interface{})
Infoln ignores the grpc info logs.
func (*Logger) Warning ¶
func (l *Logger) Warning(args ...interface{})
Warning ignores the grpc warning logs.
type RegisterFn ¶
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(etcdEndpoints []string, etcdKey, 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.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
balancer
|
|
Package mock is a generated protocol buffer package.
|
Package mock is a generated protocol buffer package. |