Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ServiceDiscovery ¶
type ServiceDiscovery interface { // GetService 获取服务实例 GetService(ctx context.Context, serviceName string) ([]*ServiceInstance, error) Watch(ctx context.Context, serviceName string) (Watcher, error) }
ServiceDiscovery 服务发现 1.本地缓存 (不需要每次请求服务,都去注册中心拿取) 2.与注册中心长连接 3.服务实例发生变化,直接推送给订阅端.
type ServiceInstance ¶
type ServiceRegistrar ¶
type ServiceRegistrar interface { // Registry 注册服务 Registry(ctx context.Context, service *ServiceInstance) error // Deregister 注销服务 Deregister(ctx context.Context, service *ServiceInstance) error }
ServiceRegistrar 服务注册
type Watcher ¶
type Watcher interface { Next() ([]*ServiceInstance, error) Stop() error }
Click to show internal directories.
Click to hide internal directories.