Skip to content

Commit

Permalink
Merge pull request #206 from darren-west/master
Browse files Browse the repository at this point in the history
Added Options() to registry interface
  • Loading branch information
Asim Aslam authored Feb 19, 2018
2 parents 42bdca6 + d970586 commit d0d9582
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
8 changes: 6 additions & 2 deletions registry/consul_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
type consulRegistry struct {
Address string
Client *consul.Client
Options Options
opts Options

sync.Mutex
register map[string]uint64
Expand Down Expand Up @@ -94,7 +94,7 @@ func newConsulRegistry(opts ...Option) Registry {
cr := &consulRegistry{
Address: config.Address,
Client: client,
Options: options,
opts: options,
register: make(map[string]uint64),
}

Expand Down Expand Up @@ -286,3 +286,7 @@ func (c *consulRegistry) Watch(opts ...WatchOption) (Watcher, error) {
func (c *consulRegistry) String() string {
return "consul"
}

func (c *consulRegistry) Options() Options {
return c.opts
}
4 changes: 4 additions & 0 deletions registry/mdns/mdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,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...)
}
4 changes: 4 additions & 0 deletions registry/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,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()
Expand Down
1 change: 1 addition & 0 deletions registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Registry interface {
ListServices() ([]*Service, error)
Watch(...WatchOption) (Watcher, error)
String() string
Options() Options
}

type Option func(*Options)
Expand Down

0 comments on commit d0d9582

Please sign in to comment.