Documentation ¶
Index ¶
- Constants
- type Component
- func (c *Component) Address() string
- func (s *Component) GracefulStop(ctx context.Context) error
- func (s *Component) Info() *server.ServiceInfo
- func (s *Component) Init() error
- func (s *Component) Name() string
- func (c *Component) PackageName() string
- func (s *Component) Start() error
- func (s *Component) Stop() error
- type Config
- type Container
- type Option
Constants ¶
View Source
const PackageName = "server.egrpc"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Component ¶
Component ...
func (*Component) GracefulStop ¶
GracefulStop implements server.Component interface it will stop echo server gracefully
func (*Component) Info ¶
func (s *Component) Info() *server.ServiceInfo
Info returns server info, used by governor and consumer balancer
func (*Component) PackageName ¶
type Config ¶
type Config struct { Host string // IP地址,默认0.0.0.0 Port int // Port端口,默认9002 Deployment string // 部署区域 Network string // 网络类型,默认tcp4 EnableMetricInterceptor bool // 是否开启监控,默认开启 EnableTraceInterceptor bool // 是否开启链路追踪,默认开启 SlowLogThreshold time.Duration // 服务慢日志,默认500ms EnableAccessInterceptorReq bool // 是否开启记录请求参数,默认不开启 EnableAccessInterceptorRes bool // 是否开启记录响应参数,默认不开启 EnableLocalMainIP bool // 自动获取ip地址 // contains filtered or unexported fields }
Config ...
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig represents default config User should construct config base on DefaultConfig
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func DefaultContainer ¶
func DefaultContainer() *Container
type Option ¶
type Option func(c *Container)
func WithServerOption ¶
func WithServerOption(options ...grpc.ServerOption) Option
WithServerOption inject server option to grpc server User should not inject interceptor option, which is recommend by WithStreamInterceptor and WithUnaryInterceptor
func WithStreamInterceptor ¶
func WithStreamInterceptor(interceptors ...grpc.StreamServerInterceptor) Option
WithStreamInterceptor inject stream interceptors to server option
func WithUnaryInterceptor ¶
func WithUnaryInterceptor(interceptors ...grpc.UnaryServerInterceptor) Option
WithUnaryInterceptor inject unary interceptors to server option
Click to show internal directories.
Click to hide internal directories.