Documentation ¶
Index ¶
- Variables
- func SetCircuitBreaker(set ISetCircuitBreaker, cnf conf.IServerConf) (enable bool, err error)
- func SetHeaders(set ISetHeaderHandler, cnf conf.IServerConf) (enable bool, err error)
- func SetHosts(set ISetHosts, cnf conf.IServerConf) (enable bool, err error)
- func SetJWT(set ISetJwtAuth, cnf conf.IServerConf) (enable bool, err error)
- func SetMetric(set ISetMetric, cnf conf.IServerConf) (enable bool, err error)
- func SetRouters(engine servers.IRegistryEngine, cnf conf.IServerConf, set ISetRouterHandler, ...) (enable bool, err error)
- func SetStatic(set ISetStatic, cnf conf.IServerConf) (enable bool, err error)
- type Handler
- type ISetCircuitBreaker
- type ISetHeaderHandler
- type ISetHosts
- type ISetJwtAuth
- type ISetMetric
- type ISetRouterHandler
- type ISetStatic
- type Option
- func WithIP(ip string) Option
- func WithLogger(logger *logger.Logger) Option
- func WithMetric(host string, dataBase string, userName string, password string, cron string) Option
- func WithName(platName string, systemName string, clusterName string, serverType string) Option
- func WithShowTrace(b bool) Option
- func WithTLS(tls []string) Option
- type Processor
- type Request
- type Routers
- type RpcResponsiveServer
- func (w *RpcResponsiveServer) GetAddress() string
- func (w *RpcResponsiveServer) GetServices() map[string][]string
- func (w *RpcResponsiveServer) GetStatus() string
- func (w *RpcResponsiveServer) NeedRestart(cnf conf.IServerConf) (bool, error)
- func (w *RpcResponsiveServer) Notify(nConf conf.IServerConf) error
- func (w *RpcResponsiveServer) Restart(cnf conf.IServerConf) (err error)
- func (w *RpcResponsiveServer) Restarted() bool
- func (w *RpcResponsiveServer) SetConf(restart bool, conf conf.IServerConf) (err error)
- func (w *RpcResponsiveServer) SetPb(f func(component.IContainer, *grpc.Server))
- func (w *RpcResponsiveServer) Shutdown()
- func (w *RpcResponsiveServer) Start() (err error)
- type RpcServer
- func (s *RpcServer) GetAddress(h ...string) string
- func (s *RpcServer) GetStatus() string
- func (s *RpcServer) Run() error
- func (s *RpcServer) SetHeader(headers conf.Headers) error
- func (s *RpcServer) SetHosts(hosts conf.Hosts) error
- func (s *RpcServer) SetJWT(auth *conf.Auth) error
- func (s *RpcServer) SetMetric(metric *conf.Metric) error
- func (s *RpcServer) SetPb(f func(component.IContainer, *grpc.Server))
- func (s *RpcServer) SetRouters(routers []*conf.Router) (err error)
- func (s *RpcServer) SetTrace(b bool)
- func (s *RpcServer) Shutdown(timeout time.Duration)
- func (s *RpcServer) StopMetric() error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrRootPrivileges = errors.New("You must have root user privileges. Possibly using 'sudo' command should help")
View Source
var ErrUnsupportedSystem = errors.New("Unsupported system")
Functions ¶
func SetCircuitBreaker ¶
func SetCircuitBreaker(set ISetCircuitBreaker, cnf conf.IServerConf) (enable bool, err error)
SetCircuitBreaker 设置熔断配置
func SetHeaders ¶
func SetHeaders(set ISetHeaderHandler, cnf conf.IServerConf) (enable bool, err error)
SetHeaders 设置header
func SetHosts ¶
func SetHosts(set ISetHosts, cnf conf.IServerConf) (enable bool, err error)
SetHosts 设置hosts
func SetJWT ¶
func SetJWT(set ISetJwtAuth, cnf conf.IServerConf) (enable bool, err error)
SetJWT 设置jwt
func SetMetric ¶
func SetMetric(set ISetMetric, cnf conf.IServerConf) (enable bool, err error)
SetMetric 设置metric
func SetRouters ¶
func SetRouters(engine servers.IRegistryEngine, cnf conf.IServerConf, set ISetRouterHandler, ext map[string]interface{}) (enable bool, err error)
func SetStatic ¶
func SetStatic(set ISetStatic, cnf conf.IServerConf) (enable bool, err error)
SetStatic 设置static
Types ¶
type Handler ¶
type Handler interface {
Handle(*dispatcher.Context)
}
type ISetCircuitBreaker ¶
type ISetCircuitBreaker interface { CloseCircuitBreaker() error SetCircuitBreaker(*conf.CircuitBreaker) error }
ISetCircuitBreaker 设置CircuitBreaker
type ISetHeaderHandler ¶
ISetHeaderHandler 设置header
type ISetMetric ¶
type ISetRouterHandler ¶
ISetRouterHandler 设置路由列表
type ISetStatic ¶
type Option ¶
type Option func(*option)
Option 配置选项
func WithMetric ¶
WithMetric 设置基于influxdb的系统监控组件
type Processor ¶
type Processor struct {
*dispatcher.Dispatcher
}
func NewProcessor ¶
func NewProcessor() *Processor
func (*Processor) Request ¶
func (r *Processor) Request(context context.Context, request *pb.RequestContext) (p *pb.ResponseContext, err error)
type Request ¶
type Request struct { *pb.RequestContext // contains filtered or unexported fields }
type Routers ¶
type Routers struct {
// contains filtered or unexported fields
}
func GetRouters ¶
func GetRouters() *Routers
type RpcResponsiveServer ¶
RpcResponsiveServer rpc 响应式服务器
func NewRpcResponsiveServer ¶
func NewRpcResponsiveServer(registryAddr string, cnf conf.IServerConf, logger *logger.Logger) (h *RpcResponsiveServer, err error)
NewRpcResponsiveServer 创建rpc服务器
func (*RpcResponsiveServer) GetAddress ¶
func (w *RpcResponsiveServer) GetAddress() string
GetAddress 获取服务器地址
func (*RpcResponsiveServer) GetServices ¶
func (w *RpcResponsiveServer) GetServices() map[string][]string
GetServices 获取服务列表
func (*RpcResponsiveServer) GetStatus ¶
func (w *RpcResponsiveServer) GetStatus() string
GetStatus 获取当前服务器状态
func (*RpcResponsiveServer) NeedRestart ¶
func (w *RpcResponsiveServer) NeedRestart(cnf conf.IServerConf) (bool, error)
NeedRestart 检查配置判断是否需要重启服务器
func (*RpcResponsiveServer) Notify ¶
func (w *RpcResponsiveServer) Notify(nConf conf.IServerConf) error
Notify 服务器配置变更通知
func (*RpcResponsiveServer) Restart ¶
func (w *RpcResponsiveServer) Restart(cnf conf.IServerConf) (err error)
Restart 重启服务器
func (*RpcResponsiveServer) Restarted ¶
func (w *RpcResponsiveServer) Restarted() bool
Restarted 服务器是否已重启
func (*RpcResponsiveServer) SetConf ¶
func (w *RpcResponsiveServer) SetConf(restart bool, conf conf.IServerConf) (err error)
SetConf 设置配置参数
func (*RpcResponsiveServer) SetPb ¶
func (w *RpcResponsiveServer) SetPb(f func(component.IContainer, *grpc.Server))
type RpcServer ¶
type RpcServer struct { *Processor // contains filtered or unexported fields }
RpcServer rpc服务器
func NewRpcServer ¶
func NewRpcServer(name string, address string, routers []*conf.Router, opts ...Option) (t *RpcServer, err error)
NewRpcServer 创建rpc服务器
func (*RpcServer) GetAddress ¶
GetAddress 获取当前服务地址
func (*RpcServer) SetRouters ¶
SetRouters 设置路由配置
Source Files ¶
Click to show internal directories.
Click to hide internal directories.