Merge pull request #206 from darren-west/master
Added Options() to registry interface
This commit is contained in:
commit
d0d9582b81
@ -17,7 +17,7 @@ import (
|
|||||||
type consulRegistry struct {
|
type consulRegistry struct {
|
||||||
Address string
|
Address string
|
||||||
Client *consul.Client
|
Client *consul.Client
|
||||||
Options Options
|
opts Options
|
||||||
|
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
register map[string]uint64
|
register map[string]uint64
|
||||||
@ -94,7 +94,7 @@ func newConsulRegistry(opts ...Option) Registry {
|
|||||||
cr := &consulRegistry{
|
cr := &consulRegistry{
|
||||||
Address: config.Address,
|
Address: config.Address,
|
||||||
Client: client,
|
Client: client,
|
||||||
Options: options,
|
opts: options,
|
||||||
register: make(map[string]uint64),
|
register: make(map[string]uint64),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,3 +286,7 @@ func (c *consulRegistry) Watch(opts ...WatchOption) (Watcher, error) {
|
|||||||
func (c *consulRegistry) String() string {
|
func (c *consulRegistry) String() string {
|
||||||
return "consul"
|
return "consul"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *consulRegistry) Options() Options {
|
||||||
|
return c.opts
|
||||||
|
}
|
||||||
|
@ -322,6 +322,10 @@ func (m *mdnsRegistry) String() string {
|
|||||||
return "mdns"
|
return "mdns"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *mdnsRegistry) Options() registry.Options {
|
||||||
|
return m.opts
|
||||||
|
}
|
||||||
|
|
||||||
func NewRegistry(opts ...registry.Option) registry.Registry {
|
func NewRegistry(opts ...registry.Option) registry.Registry {
|
||||||
return newRegistry(opts...)
|
return newRegistry(opts...)
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,10 @@ func (m *mockRegistry) String() string {
|
|||||||
return "mock"
|
return "mock"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *mockRegistry) Options() registry.Options {
|
||||||
|
return registry.Options{}
|
||||||
|
}
|
||||||
|
|
||||||
func NewRegistry() registry.Registry {
|
func NewRegistry() registry.Registry {
|
||||||
m := &mockRegistry{Services: make(map[string][]*registry.Service)}
|
m := &mockRegistry{Services: make(map[string][]*registry.Service)}
|
||||||
m.init()
|
m.init()
|
||||||
|
@ -15,6 +15,7 @@ type Registry interface {
|
|||||||
ListServices() ([]*Service, error)
|
ListServices() ([]*Service, error)
|
||||||
Watch(...WatchOption) (Watcher, error)
|
Watch(...WatchOption) (Watcher, error)
|
||||||
String() string
|
String() string
|
||||||
|
Options() Options
|
||||||
}
|
}
|
||||||
|
|
||||||
type Option func(*Options)
|
type Option func(*Options)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user