Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigInfo ¶
type ConfigInfo struct {
Routes []Route
}
ConfigInfo represents service configurator
type Option ¶
type Option func(c *ServiceInfo)
Option overrides a Container's default configuration.
type OrderServer ¶ added in v1.1.10
type OrderServer interface {
standard.Component
// Prepare 用于一些准备数据
// 因为在OrderServer中,也会有invoker操作,需要放这个里面执行,需要区分他和真正server的init操作
// server的init操作有一些listen,必须先执行,否则有些通信,会有问题
Prepare() error
GracefulStop(ctx context.Context) error
Info() *ServiceInfo
Health() bool
Invoker(fns ...func() error) // 用户初始化函数,放在order server里执行
}
OrderServer ... Experimental
type ReloadServer ¶ added in v1.2.4
type ReloadServer interface {
standard.Component
GracefulStop(ctx context.Context) error
Info() *ServiceInfo
Listener() net.Listener
}
ReloadServer ... Experimental
type Route ¶
type Route struct {
// 权重组,按照
WeightGroups []WeightGroup
// 方法名
Method string
}
Route ...
type Server ¶
type Server interface {
standard.Component
GracefulStop(ctx context.Context) error
Info() *ServiceInfo
}
Server ...
type Service ¶
type Service struct {
Namespace string `json:"namespace" toml:"namespace"`
Name string `json:"name" toml:"name"`
Labels map[string]string `json:"labels" toml:"labels"`
Methods []string `json:"methods" toml:"methods"`
}
Service ...
type ServiceInfo ¶
type ServiceInfo struct {
Name string `json:"name"`
Scheme string `json:"scheme"`
Address string `json:"address"`
Weight float64 `json:"weight"`
Enable bool `json:"enable"`
Healthy bool `json:"healthy"`
Metadata map[string]string `json:"metadata"`
Region string `json:"region"`
Zone string `json:"zone"`
Kind constant.ServiceKind `json:"kind"`
Deployment string `json:"deployment"` // Deployment 部署组: 不同组的流量隔离, 比如某些服务给内部调用和第三方调用,可以配置不同的deployment,进行流量隔离
Group string `json:"group"` // Group 流量组: 流量在Group之间进行负载均衡
Services map[string]*Service `json:"services" toml:"services"`
}
ServiceInfo represents service info
func (ServiceInfo) Equal ¶ added in v0.7.0
func (si ServiceInfo) Equal(o interface{}) bool
Equal 一定要实现这个方法,在gRPC的attributes里会使用该方法断言,判断是否相等
func (*ServiceInfo) GetServiceKey ¶ added in v0.7.0
func (si *ServiceInfo) GetServiceKey(prefix string) string
GetServiceKey ETCD注册需要使用
func (*ServiceInfo) GetServiceValue ¶ added in v0.7.0
func (si *ServiceInfo) GetServiceValue() string
GetServiceValue ETCD注册需要使用的服务信息
Click to show internal directories.
Click to hide internal directories.