From d970586a29ac02ab1c04bd16f0e72f277246d4b3 Mon Sep 17 00:00:00 2001 From: darren-west Date: Thu, 28 Sep 2017 11:16:56 +0100 Subject: [PATCH] Added Options() to registry interface --- registry/consul_registry.go | 8 ++++++-- registry/mdns/mdns.go | 4 ++++ registry/mock/mock.go | 4 ++++ registry/registry.go | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/registry/consul_registry.go b/registry/consul_registry.go index 2f09ab4174..e0d8555755 100644 --- a/registry/consul_registry.go +++ b/registry/consul_registry.go @@ -17,7 +17,7 @@ import ( type consulRegistry struct { Address string Client *consul.Client - Options Options + opts Options sync.Mutex register map[string]uint64 @@ -93,7 +93,7 @@ func newConsulRegistry(opts ...Option) Registry { cr := &consulRegistry{ Address: config.Address, Client: client, - Options: options, + opts: options, register: make(map[string]uint64), } @@ -285,3 +285,7 @@ func (c *consulRegistry) Watch() (Watcher, error) { func (c *consulRegistry) String() string { return "consul" } + +func (c *consulRegistry) Options() Options { + return c.opts +} diff --git a/registry/mdns/mdns.go b/registry/mdns/mdns.go index 47f9f8d522..e06893d2e4 100644 --- a/registry/mdns/mdns.go +++ b/registry/mdns/mdns.go @@ -316,6 +316,10 @@ func (m *mdnsRegistry) String() string { return "mdns" } +func (m *mdnsRegistry) Options() registry.Options { + return m.opts +} + func NewRegistry(opts ...registry.Option) registry.Registry { return newRegistry(opts...) } diff --git a/registry/mock/mock.go b/registry/mock/mock.go index 9dd39b3aef..1fa87ed04a 100644 --- a/registry/mock/mock.go +++ b/registry/mock/mock.go @@ -95,6 +95,10 @@ func (m *mockRegistry) String() string { return "mock" } +func (m *mockRegistry) Options() registry.Options { + return registry.Options{} +} + func NewRegistry() registry.Registry { m := &mockRegistry{Services: make(map[string][]*registry.Service)} m.init() diff --git a/registry/registry.go b/registry/registry.go index f3465bf3b4..ae9ec6d53c 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -15,6 +15,7 @@ type Registry interface { ListServices() ([]*Service, error) Watch() (Watcher, error) String() string + Options() Options } type Option func(*Options)