|
|
|
@ -21,15 +21,15 @@ func WithLogger(logger log.Logger) Option { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type builder struct { |
|
|
|
|
registry registry.Discovery |
|
|
|
|
logger log.Logger |
|
|
|
|
discoverer registry.Discoverer |
|
|
|
|
logger log.Logger |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// NewBuilder creates a builder which is used to factory registry resolvers.
|
|
|
|
|
func NewBuilder(r registry.Discovery, opts ...Option) resolver.Builder { |
|
|
|
|
func NewBuilder(r registry.Discoverer, opts ...Option) resolver.Builder { |
|
|
|
|
b := &builder{ |
|
|
|
|
registry: r, |
|
|
|
|
logger: log.DefaultLogger, |
|
|
|
|
discoverer: r, |
|
|
|
|
logger: log.DefaultLogger, |
|
|
|
|
} |
|
|
|
|
for _, o := range opts { |
|
|
|
|
o(b) |
|
|
|
@ -38,7 +38,7 @@ func NewBuilder(r registry.Discovery, opts ...Option) resolver.Builder { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (d *builder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) { |
|
|
|
|
w, err := d.registry.Watch(context.Background(), target.Endpoint) |
|
|
|
|
w, err := d.discoverer.Watch(context.Background(), target.Endpoint) |
|
|
|
|
if err != nil { |
|
|
|
|
return nil, err |
|
|
|
|
} |
|
|
|
|