Documentation
¶
Index ¶
- func GetService(s string) *server.ServiceInfo
- func GetServiceKey(prefix string, s *server.ServiceInfo) string
- func GetServiceValue(s *server.ServiceInfo) string
- func RegisterBuilder(kind string, build Builder)
- func Service(srv server.Server) server.Server
- type BuildFunc
- type Builder
- type Config
- type ConfigLab
- type Configuration
- type ConsumerConfig
- type Endpoints
- type Event
- type EventMessage
- type Kind
- type Local
- func (n Local) Close() error
- func (n Local) Kind() string
- func (n Local) ListServices(ctx context.Context, s string) ([]*server.ServiceInfo, error)
- func (n Local) RegisterService(ctx context.Context, si *server.ServiceInfo) error
- func (n Local) UnregisterService(ctx context.Context, si *server.ServiceInfo) error
- func (n Local) WatchServices(ctx context.Context, s string) (chan Endpoints, error)
- type Operation
- type ProviderConfig
- type Registry
- type Route
- type RouteConfig
- type ServerInstance
- type Update
- type Upstream
- type WeightGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetServiceKey ¶
func GetServiceKey(prefix string, s *server.ServiceInfo) string
GetServiceKey ..
Types ¶
type Config ¶
Config ...
func (Config) InitDefaultRegister ¶
func (config Config) InitDefaultRegister()
InitDefaultRegister ...
type ConfigLab ¶
type ConfigLab struct {
Kind string `json:"kind" description:"底层注册器类型, eg: etcdv3, consul"`
ConfigKey string `json:"configKey" description:"底册注册器的配置键"`
DeplaySeconds int `json:"deplaySeconds" description:"延迟注册"`
}
ConfigLab ...
type Configuration ¶
type Configuration struct {
Routes []Route `json:"routes"` // 配置客户端路由策略
Labels map[string]string `json:"labels"` // 配置服务端标签: 分组
}
Configuration ...
type ConsumerConfig ¶
type ConsumerConfig struct {
ID string `json:"id"`
Scheme string `json:"scheme"`
Host string `json:"host"`
}
ConsumerConfig config of consumer 客户端调用app的配置
type Endpoints ¶
type Endpoints struct {
// 服务节点列表
Nodes map[string]server.ServiceInfo
// 路由配置
RouteConfigs map[string]RouteConfig
// 消费者元数据
ConsumerConfigs map[string]ConsumerConfig
// 服务元信息
ProviderConfigs map[string]ProviderConfig
}
Endpoints ...
type EventMessage ¶
EventMessage ...
type Kind ¶
type Kind uint8
Kind ...
type Local ¶
type Local struct{}
Local Nop registry, used for local development/debugging
func (Local) ListServices ¶
ListServices ...
func (Local) RegisterService ¶
RegisterService ...
func (Local) UnregisterService ¶
UnregisterService ...
type ProviderConfig ¶
type ProviderConfig struct {
ID string `json:"id"`
Scheme string `json:"scheme"`
Host string `json:"host"`
Region string `json:"region"`
Zone string `json:"zone"`
Deployment string `json:"deployment"`
Metadata map[string]string `json:"metadata"`
Enable bool `json:"enable"`
}
ProviderConfig config of provider 通过这个配置,修改provider的属性
type Registry ¶
type Registry interface {
RegisterService(context.Context, *server.ServiceInfo) error
UnregisterService(context.Context, *server.ServiceInfo) error
ListServices(context.Context, string) ([]*server.ServiceInfo, error)
WatchServices(context.Context, string) (chan Endpoints, error)
Kind() string
io.Closer
}
Registry register/unregister service registry impl should control rpc timeout
type Route ¶
type Route struct {
// 路由方法名
Method string `json:"method" toml:"method"`
// 路由权重组, 按比率在各个权重组中分配流量
WeightGroups []WeightGroup `json:"weightGroups" toml:"weightGroups"`
// 路由部署组, 将流量导入部署组
Deployment string `json:"deployment" toml:"deployment"`
}
Route represents route configuration
type RouteConfig ¶
type RouteConfig struct {
ID string `json:"id" toml:"id"`
Scheme string `json:"scheme" toml:"scheme"`
Host string `json:"host" toml:"host"`
Deployment string `json:"deployment"`
URI string `json:"uri"`
Upstream Upstream `json:"upstream"`
}
RouteConfig ...
type ServerInstance ¶
ServerInstance ...
type Update ¶ added in v3.2.29
type Update struct {
// Op indicates the operation of the update.
Op Operation
// Addr is the updated address. It is empty string if there is no address update.
Addr string
// Metadata is the updated metadata. It is nil if there is no metadata update.
// Metadata is not required for a custom naming implementation.
Metadata *server.ServiceInfo
}
Update defines a name resolution update. Notice that it is not valid having both empty string Addr and nil Metadata in an Update.
type WeightGroup ¶
type WeightGroup struct {
Group string `json:"group" toml:"group"`
Weight int `json:"weight" toml:"weight"`
}
WeightGroup ...
Click to show internal directories.
Click to hide internal directories.