mirror of
https://github.com/go-micro/go-micro.git
synced 2024-11-24 08:02:32 +02:00
Added Options() to registry interface
This commit is contained in:
parent
d29b5e2fab
commit
d970586a29
@ -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
|
||||
}
|
||||
|
@ -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...)
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -15,6 +15,7 @@ type Registry interface {
|
||||
ListServices() ([]*Service, error)
|
||||
Watch() (Watcher, error)
|
||||
String() string
|
||||
Options() Options
|
||||
}
|
||||
|
||||
type Option func(*Options)
|
||||
|
Loading…
Reference in New Issue
Block a user