add options method
This commit is contained in:
parent
1d69bd4a16
commit
5b1127bceb
@ -37,6 +37,7 @@ type delegate struct {
|
|||||||
type gossipRegistry struct {
|
type gossipRegistry struct {
|
||||||
broadcasts *memberlist.TransmitLimitedQueue
|
broadcasts *memberlist.TransmitLimitedQueue
|
||||||
updates chan *update
|
updates chan *update
|
||||||
|
options registry.Options
|
||||||
|
|
||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
services map[string][]*registry.Service
|
services map[string][]*registry.Service
|
||||||
@ -341,6 +342,10 @@ func (m *gossipRegistry) run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *gossipRegistry) Options() registry.Options {
|
||||||
|
return m.options
|
||||||
|
}
|
||||||
|
|
||||||
func (m *gossipRegistry) Register(s *registry.Service, opts ...registry.RegisterOption) error {
|
func (m *gossipRegistry) Register(s *registry.Service, opts ...registry.RegisterOption) error {
|
||||||
m.Lock()
|
m.Lock()
|
||||||
if service, ok := m.services[s.Name]; !ok {
|
if service, ok := m.services[s.Name]; !ok {
|
||||||
@ -451,6 +456,7 @@ func NewRegistry(opts ...registry.Option) registry.Registry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mr := &gossipRegistry{
|
mr := &gossipRegistry{
|
||||||
|
options: options,
|
||||||
broadcasts: broadcasts,
|
broadcasts: broadcasts,
|
||||||
services: make(map[string][]*registry.Service),
|
services: make(map[string][]*registry.Service),
|
||||||
updates: updates,
|
updates: updates,
|
||||||
|
Loading…
Reference in New Issue
Block a user