Documentation ¶
Index ¶
- Constants
- func GetService(s string) *server.ServiceInfo
- func GetServiceKey(prefix string, s *server.ServiceInfo) string
- func GetServiceValue(s *server.ServiceInfo) string
- type Configuration
- type ConsumerConfig
- type Endpoints
- type Nop
- func (n Nop) Close() error
- func (n Nop) ListServices(ctx context.Context, target Target) ([]*server.ServiceInfo, error)
- func (n Nop) RegisterService(context.Context, *server.ServiceInfo) error
- func (n Nop) SyncServices(context.Context, SyncServicesOptions) error
- func (n Nop) UnregisterService(context.Context, *server.ServiceInfo) error
- func (n Nop) WatchServices(ctx context.Context, target Target) (chan Endpoints, error)
- type ProviderConfig
- type Registry
- type Route
- type RouteConfig
- type SyncServicesOptions
- type Target
- type Upstream
- type WeightGroup
Constants ¶
View Source
const ( // ProtocolGRPC ... ProtocolGRPC = "grpc" // ProtocolHTTP ... ProtocolHTTP = "http" )
Variables ¶
This section is empty.
Functions ¶
func GetServiceKey ¶
func GetServiceKey(prefix string, s *server.ServiceInfo) string
GetServiceKey ..
Types ¶
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 服务节点列表 Nodes map[string]server.ServiceInfo `json:"nodes"` // RouteConfigs 路由配置 RouteConfigs map[string]RouteConfig `json:"routeConfigs"` // ConsumerConfigs 消费者元数据 ConsumerConfigs map[string]ConsumerConfig `json:"consumerConfigs"` // ProviderConfigs 服务元信息 ProviderConfigs map[string]ProviderConfig `json:"providerConfigs"` }
Endpoints ...
type Nop ¶
type Nop struct{}
Nop registry, used for local development/debugging
func (Nop) ListServices ¶
ListServices ...
func (Nop) RegisterService ¶
RegisterService ...
func (Nop) SyncServices ¶ added in v0.5.0
func (n Nop) SyncServices(context.Context, SyncServicesOptions) error
SyncServices 同步所有服务
func (Nop) 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, Target) ([]*server.ServiceInfo, error) WatchServices(context.Context, Target) (chan Endpoints, error) SyncServices(context.Context, SyncServicesOptions) error 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 SyncServicesOptions ¶ added in v0.5.0
type SyncServicesOptions struct {
GrpcResolverNowOptions resolver.ResolveNowOptions
}
SyncServicesOptions ...
type Target ¶ added in v0.5.0
type Target struct { Protocol string // "http"|"grpc" Scheme string // "etcd"|"k8s"|"dns" Endpoint string // "<SVC-NAME>:<PORT>" Authority string }
Target ...
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.