|
@@ -111,14 +111,14 @@ func (r *Registry) Deregister(ctx context.Context, service *registry.ServiceInst
|
|
|
cancel()
|
|
cancel()
|
|
|
delete(r.ctxMap, service)
|
|
delete(r.ctxMap, service)
|
|
|
}
|
|
}
|
|
|
- key := fmt.Sprintf("%s/%s/%s", r.opts.namespace, service.Name, service.ID)
|
|
|
|
|
|
|
+ key := fmt.Sprintf("/%s/naming/%s/%s", r.opts.namespace, service.Name, service.ID)
|
|
|
_, err := r.client.Delete(ctx, key)
|
|
_, err := r.client.Delete(ctx, key)
|
|
|
return err
|
|
return err
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// GetService return the service instances in memory according to the service name.
|
|
// GetService return the service instances in memory according to the service name.
|
|
|
func (r *Registry) GetService(ctx context.Context, name string) ([]*registry.ServiceInstance, error) {
|
|
func (r *Registry) GetService(ctx context.Context, name string) ([]*registry.ServiceInstance, error) {
|
|
|
- key := fmt.Sprintf("%s/%s", r.opts.namespace, name)
|
|
|
|
|
|
|
+ key := fmt.Sprintf("/%s/naming/%s", r.opts.namespace, name)
|
|
|
resp, err := r.kv.Get(ctx, key, clientv3.WithPrefix())
|
|
resp, err := r.kv.Get(ctx, key, clientv3.WithPrefix())
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return nil, err
|
|
return nil, err
|
|
@@ -139,7 +139,7 @@ func (r *Registry) GetService(ctx context.Context, name string) ([]*registry.Ser
|
|
|
|
|
|
|
|
// Watch creates a watcher according to the service name.
|
|
// Watch creates a watcher according to the service name.
|
|
|
func (r *Registry) Watch(ctx context.Context, name string) (registry.Watcher, error) {
|
|
func (r *Registry) Watch(ctx context.Context, name string) (registry.Watcher, error) {
|
|
|
- key := fmt.Sprintf("%s/%s", r.opts.namespace, name)
|
|
|
|
|
|
|
+ key := fmt.Sprintf("/%s/naming/%s", r.opts.namespace, name)
|
|
|
return newWatcher(ctx, key, name, r.client)
|
|
return newWatcher(ctx, key, name, r.client)
|
|
|
}
|
|
}
|
|
|
|
|
|