Documentation ¶
Index ¶
- func NewSentinelUnaryServerInterceptor() grpc.UnaryServerInterceptor
- func NewTraceStreamServerInterceptor() grpc.StreamServerInterceptor
- func NewTraceUnaryServerInterceptor() grpc.UnaryServerInterceptor
- func StreamInterceptorChain(interceptors ...grpc.StreamServerInterceptor) grpc.StreamServerInterceptor
- func UnaryInterceptorChain(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
- type Config
- func (config Config) Address() string
- func (config *Config) Build() (*Server, error)
- func (config *Config) MustBuild() *Server
- func (config *Config) WithLogger(logger *xlog.Logger) *Config
- func (config *Config) WithServerOption(options ...grpc.ServerOption) *Config
- func (config *Config) WithStreamInterceptor(intes ...grpc.StreamServerInterceptor) *Config
- func (config *Config) WithUnaryInterceptor(intes ...grpc.UnaryServerInterceptor) *Config
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSentinelUnaryServerInterceptor ¶ added in v0.9.7
func NewSentinelUnaryServerInterceptor() grpc.UnaryServerInterceptor
func NewTraceStreamServerInterceptor ¶ added in v0.6.6
func NewTraceStreamServerInterceptor() grpc.StreamServerInterceptor
func NewTraceUnaryServerInterceptor ¶ added in v0.6.6
func NewTraceUnaryServerInterceptor() grpc.UnaryServerInterceptor
func StreamInterceptorChain ¶
func StreamInterceptorChain(interceptors ...grpc.StreamServerInterceptor) grpc.StreamServerInterceptor
StreamInterceptorChain returns stream interceptors chain.
func UnaryInterceptorChain ¶
func UnaryInterceptorChain(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
UnaryInterceptorChain returns interceptors chain.
Types ¶
type Config ¶
type Config struct { Name string `json:"name"` Host string `json:"host"` Port int `json:"port"` Deployment string `json:"deployment"` // Network network type, tcp4 by default Network string `json:"network" toml:"network"` // EnableAccessLog enable Access Interceptor, true by default EnableAccessLog bool // DisableTrace disbale Trace Interceptor, false by default DisableTrace bool // DisableMetric disable Metric Interceptor, false by default DisableMetric bool // DisableSentinel disable Sentinel Interceptor, false by default DisableSentinel bool // SlowQueryThresholdInMilli, request will be colored if cost over this threshold value SlowQueryThresholdInMilli int64 // ServiceAddress service address in registry info, default to 'Host:Port' ServiceAddress string // EnableTLS EnableTLS bool // CaFile CaFile string // CertFile CertFile string // PrivateFile PrivateFile string Labels map[string]string `json:"labels"` // contains filtered or unexported fields }
Config ...
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig represents default config User should construct config base on DefaultConfig
func StdConfig ¶
StdConfig represents Standard gRPC Server config which will parse config by conf package, panic if no config key found in conf
func (*Config) WithLogger ¶
WithLogger ...
func (*Config) WithServerOption ¶
func (config *Config) WithServerOption(options ...grpc.ServerOption) *Config
WithServerOption inject server option to grpc server User should not inject interceptor option, which is recommend by WithStreamInterceptor and WithUnaryInterceptor
func (*Config) WithStreamInterceptor ¶
func (config *Config) WithStreamInterceptor(intes ...grpc.StreamServerInterceptor) *Config
WithStreamInterceptor inject stream interceptors to server option
func (*Config) WithUnaryInterceptor ¶
func (config *Config) WithUnaryInterceptor(intes ...grpc.UnaryServerInterceptor) *Config
WithUnaryInterceptor inject unary interceptors to server option
type Server ¶
Server ...
func (*Server) GracefulStop ¶
GracefulStop implements server.Server interface it will stop echo server gracefully
func (*Server) Info ¶
func (s *Server) Info() *server.ServiceInfo
Info returns server info, used by governor and consumer balancer