Documentation
¶
Index ¶
- Constants
- type Discover
- type Option
- func WithAuthFunc(a interceptor.Authorize) Option
- func WithDiscover(d Discover, tags ...string) Option
- func WithGrpcAddr(addr string) Option
- func WithGrpcServerOption(opts ...grpc.ServerOption) Option
- func WithHttpAddr(addr string) Option
- func WithHttpServerOption(opts ...mux.Optional) Option
- func WithLimiter(l *limit.Limiter) Option
- func WithLogger(logger grpc_logging.Logger) Option
- func WithLoggingDecider(decider logging.Decider) Option
- func WithMetricsAddr(addr string) Option
- func WithRequestFieldExtractor(f logging.RequestFieldExtractorFunc) Option
- func WithResponseFieldExtractor(f logging.ResponseFieldExtractorFunc) Option
- func WithStreamServerInterceptor(f grpc.StreamServerInterceptor) Option
- func WithTags(tags []string) Option
- func WithTracer(tracer opentracing.Tracer) Option
- func WithUnaryServerInterceptor(f grpc.UnaryServerInterceptor) Option
- type Server
- func (s *Server) Close(ctx context.Context) error
- func (s *Server) Handle(method, path string, h runtime.HandlerFunc)
- func (s *Server) RegisterService(ctx context.Context, desc *grpc.ServiceDesc, serviceImpl interface{})
- func (s *Server) ServeMux() *runtime.ServeMux
- func (s *Server) Start(ctx context.Context)
Constants ¶
const ( // InitialWindowSize we set it 1GB is to provide system's throughput. InitialWindowSize = 1 << 30 // InitialConnWindowSize we set it 1GB is to provide system's throughput. InitialConnWindowSize = 1 << 30 // MaxSendMsgSize set max gRPC request message size sent to server. // If any request message size is larger than current value, an error will be reported from gRPC. MaxSendMsgSize = 4 << 30 // MaxRecvMsgSize set max gRPC receive message size received from server. // If any message size is larger than current value, an error will be reported from gRPC. MaxRecvMsgSize = 4 << 30 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Discover ¶ added in v0.2.12
type Discover interface { ServiceRegister(ctx context.Context, name, addr string, tags []string, meta map[string]string) error ServiceDeregister(ctx context.Context, name string) error }
Discover service discovery
type Option ¶
type Option func(*options)
Option the option for this module
func WithDiscover ¶ added in v0.2.12
WithDiscover
func WithGrpcServerOption ¶
func WithGrpcServerOption(opts ...grpc.ServerOption) Option
WithGRPCServerOption with other grpc options
func WithHttpServerOption ¶
WithHTTPServerOption with http server options
func WithLimiter ¶ added in v0.2.18
WithLimiter performs rate limiting on the request.
func WithLoggingDecider ¶
WithLoggingDecider Decider how log output.
func WithRequestFieldExtractor ¶
func WithRequestFieldExtractor(f logging.RequestFieldExtractorFunc) Option
WithRequestFieldExtractor customizes the function for extracting log fields from protobuf messages, for unary and server-streamed methods only.
func WithResponseFieldExtractor ¶
func WithResponseFieldExtractor(f logging.ResponseFieldExtractorFunc) Option
WithResponseFieldExtractor customizes the function for extracting log fields from protobuf messages, for unary and server-streamed methods only.
func WithStreamServerInterceptor ¶
func WithStreamServerInterceptor(f grpc.StreamServerInterceptor) Option
WithStreamServerInterceptor
func WithUnaryServerInterceptor ¶
func WithUnaryServerInterceptor(f grpc.UnaryServerInterceptor) Option
WithUnaryServerInterceptor
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server the grpc server
func (*Server) Close ¶
Close K8s closes after 60 seconds by default refer: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/
func (*Server) Handle ¶
func (s *Server) Handle(method, path string, h runtime.HandlerFunc)
Handle registering HTTP handler
func (*Server) RegisterService ¶
func (s *Server) RegisterService(ctx context.Context, desc *grpc.ServiceDesc, serviceImpl interface{})
RegisterService registering gRPC service