Documentation
¶
Index ¶
- Variables
- type ClientConnection
- type DialOption
- type HealthHandler
- func (s *HealthHandler) AddConn(svrName string, conn *ClientConnection)
- func (s *HealthHandler) AddService(svrName string, addr string)
- func (s *HealthHandler) Check(ctx context.Context, in *healthPb.HealthCheckRequest) (*healthPb.HealthCheckResponse, error)
- func (s *HealthHandler) CheckConnection(ctx context.Context) error
- type Server
- type ServerOption
Constants ¶
This section is empty.
Variables ¶
View Source
var ClientPayloadLoggingDecider = func(ctx context.Context, fullMethodName string) bool { return false }
View Source
var DebugCodeToLevel = func(code codes.Code) zapcore.Level { return zap.DebugLevel }
View Source
var DefaultCodeToLevel = func(code codes.Code) zapcore.Level { switch code { case codes.Unknown, codes.DeadlineExceeded, codes.PermissionDenied, codes.Unauthenticated, codes.Unimplemented, codes.Internal, codes.DataLoss, codes.Unavailable, codes.OutOfRange, codes.ResourceExhausted, codes.FailedPrecondition, codes.Aborted: return zap.InfoLevel default: return zap.DebugLevel } }
View Source
var DefaultDialOpts = func(logger *zap.Logger) []grpc.DialOption { return []grpc.DialOption{ grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithKeepaliveParams(keepalive.ClientParameters{Time: 60 * time.Second, Timeout: time.Minute * 2, PermitWithoutStream: true}), } }
View Source
var DefaultLoggingDialOpts = func(logger *zap.Logger) []grpc.DialOption { return []grpc.DialOption{ grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithKeepaliveParams(keepalive.ClientParameters{Time: 60 * time.Second, Timeout: time.Minute * 2, PermitWithoutStream: true}), } }
View Source
var DefaultLoggingServerOptions = func(logger *zap.Logger) []interface{} { return []interface{}{ grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{MinTime: 1 * time.Minute, PermitWithoutStream: true}), CtxTagsServerOption(), ValidatorServerOption(), RecoveryServerOption(), } }
View Source
var DefaultServerOptions = func(logger *zap.Logger) []interface{} { return []interface{}{ grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{MinTime: 1 * time.Minute, PermitWithoutStream: true}), CtxTagsServerOption(), ValidatorServerOption(), RecoveryServerOption(), } }
View Source
var ServerPayloadLoggingDecider = func(ctx context.Context, fullMethodName string, servingObject interface{}) bool { return false }
View Source
var TestSvrOpts = func(logger *zap.Logger) []interface{} { return []interface{}{ CtxTagsServerOption, ValidatorServerOption, RecoveryServerOption, } }
Functions ¶
This section is empty.
Types ¶
type ClientConnection ¶
type ClientConnection struct { Connection *grpc.ClientConn // contains filtered or unexported fields }
func NewClientConnection ¶
func NewClientConnection(addr string) *ClientConnection
func (*ClientConnection) CleanUp ¶
func (c *ClientConnection) CleanUp() error
func (*ClientConnection) Dial ¶
func (c *ClientConnection) Dial(opts ...grpc.DialOption) error
func (*ClientConnection) DialContext ¶
func (c *ClientConnection) DialContext(ctx context.Context, opts ...grpc.DialOption) error
type DialOption ¶
type DialOption struct { grpc.EmptyDialOption // contains filtered or unexported fields }
func NewDialOption ¶
func NewDialOption(f func(conn *ClientConnection)) DialOption
type HealthHandler ¶
type HealthHandler struct { *health.Server GServer *Server // contains filtered or unexported fields }
func NewHealthServer ¶
func (*HealthHandler) AddConn ¶
func (s *HealthHandler) AddConn(svrName string, conn *ClientConnection)
func (*HealthHandler) AddService ¶
func (s *HealthHandler) AddService(svrName string, addr string)
func (*HealthHandler) Check ¶
func (s *HealthHandler) Check(ctx context.Context, in *healthPb.HealthCheckRequest) (*healthPb.HealthCheckResponse, error)
func (*HealthHandler) CheckConnection ¶
func (s *HealthHandler) CheckConnection(ctx context.Context) error
type Server ¶
func (*Server) GetHttpProxy ¶
type ServerOption ¶
type ServerOption func(s *Server)
func CtxTagsServerOption ¶
func CtxTagsServerOption() ServerOption
func RecoveryServerOption ¶
func RecoveryServerOption() ServerOption
func ValidatorServerOption ¶
func ValidatorServerOption() ServerOption
Click to show internal directories.
Click to hide internal directories.