Documentation ¶
Overview ¶
Package etcd is registered as a service using etcd.
Index ¶
- func NewRegistry(etcdEndpoints []string, id string, instanceName string, ...) (registry.Registry, *registry.ServiceInstance, error)
- type Option
- type Registry
- func (r *Registry) Deregister(ctx context.Context, service *registry.ServiceInstance) error
- func (r *Registry) GetService(ctx context.Context, name string) ([]*registry.ServiceInstance, error)
- func (r *Registry) IsServiceRegistered(ctx context.Context, key string) (bool, error)
- func (r *Registry) Register(ctx context.Context, service *registry.ServiceInstance) (*clientv3.Client, error)
- func (r *Registry) Watch(ctx context.Context, name string) (registry.Watcher, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRegistry ¶
func NewRegistry(etcdEndpoints []string, id string, instanceName string, instanceEndpoints []string, opts ...etcdcli.Option) (registry.Registry, *registry.ServiceInstance, error)
NewRegistry 创建一个新的 etcd 注册表实例。 注意:如果设置了 etcdcli.WithConfig(*clientv3.Config) 参数,则 etcdEndpoints 参数将被忽略!
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry 是 etcd 注册表。
func (*Registry) Deregister ¶
Deregister 注销服务实例。
func (*Registry) GetService ¶
func (r *Registry) GetService(ctx context.Context, name string) ([]*registry.ServiceInstance, error)
GetService 根据服务名称获取服务实例列表。
func (*Registry) IsServiceRegistered ¶ added in v1.0.51
IsServiceRegistered 检查给定的服务实例是否已注册。
Click to show internal directories.
Click to hide internal directories.