diff --git a/app.go b/app.go index 875951ee6..a451ce010 100644 --- a/app.go +++ b/app.go @@ -57,9 +57,9 @@ func (a *App) Server() []transport.Server { return a.opts.servers } -// Registry returns registry. -func (a *App) Registry() registry.Registrar { - return a.opts.registry +// Registrar returns registry. +func (a *App) Registrar() registry.Registrar { + return a.opts.registrar } // Run executes all OnStart hooks registered with the application's Lifecycle. @@ -80,8 +80,8 @@ func (a *App) Run() error { return srv.Start() }) } - if a.opts.registry != nil { - if err := a.opts.registry.Register(a.opts.ctx, a.instance); err != nil { + if a.opts.registrar != nil { + if err := a.opts.registrar.Register(a.opts.ctx, a.instance); err != nil { return err } } @@ -105,8 +105,8 @@ func (a *App) Run() error { // Stop gracefully stops the application. func (a *App) Stop() error { - if a.opts.registry != nil { - if err := a.opts.registry.Deregister(a.opts.ctx, a.instance); err != nil { + if a.opts.registrar != nil { + if err := a.opts.registrar.Deregister(a.opts.ctx, a.instance); err != nil { return err } } diff --git a/options.go b/options.go index 63e25c32c..cecb4eaa0 100644 --- a/options.go +++ b/options.go @@ -23,8 +23,8 @@ type options struct { ctx context.Context sigs []os.Signal - logger log.Logger - registry registry.Registrar + logger log.Logger + registrar registry.Registrar servers []transport.Server } @@ -69,9 +69,9 @@ func Logger(logger log.Logger) Option { return func(o *options) { o.logger = logger } } -// Registry with service registry. -func Registry(r registry.Registrar) Option { - return func(o *options) { o.registry = r } +// Registrar with service registry. +func Registrar(r registry.Registrar) Option { + return func(o *options) { o.registrar = r } } // Server with transport servers. diff --git a/transport/grpc/client.go b/transport/grpc/client.go index 5330ab228..330b65531 100644 --- a/transport/grpc/client.go +++ b/transport/grpc/client.go @@ -38,10 +38,10 @@ func WithMiddleware(m middleware.Middleware) ClientOption { } } -// WithDiscovery with client registry. -func WithDiscovery(r registry.Discoverer) ClientOption { +// WithDiscoverer with client registry. +func WithDiscoverer(d registry.Discoverer) ClientOption { return func(o *clientOptions) { - o.discovery = r + o.discoverer = d } } @@ -57,7 +57,7 @@ type clientOptions struct { endpoint string timeout time.Duration middleware middleware.Middleware - discovery registry.Discoverer + discoverer registry.Discoverer grpcOpts []grpc.DialOption } @@ -86,8 +86,8 @@ func dial(ctx context.Context, insecure bool, opts ...ClientOption) (*grpc.Clien grpc.WithTimeout(options.timeout), grpc.WithUnaryInterceptor(UnaryClientInterceptor(options.middleware)), } - if options.discovery != nil { - grpc.WithResolvers(discovery.NewBuilder(options.discovery)) + if options.discoverer != nil { + grpc.WithResolvers(discovery.NewBuilder(options.discoverer)) } if insecure { grpcOpts = append(grpcOpts, grpc.WithInsecure())