2020-08-29 17:41:49 +03:00
|
|
|
package registry
|
|
|
|
|
2020-09-03 15:11:05 +03:00
|
|
|
import "fmt"
|
2020-08-29 17:41:49 +03:00
|
|
|
|
2020-09-03 15:11:05 +03:00
|
|
|
type noopRegistry struct {
|
|
|
|
opts Options
|
|
|
|
}
|
2020-08-29 17:41:49 +03:00
|
|
|
|
2020-09-03 15:11:05 +03:00
|
|
|
func (n *noopRegistry) Init(opts ...Option) error {
|
|
|
|
for _, o := range opts {
|
|
|
|
o(&n.opts)
|
|
|
|
}
|
2020-08-29 17:41:49 +03:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *noopRegistry) Options() Options {
|
2020-09-03 15:11:05 +03:00
|
|
|
return n.opts
|
2020-08-29 17:41:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (n *noopRegistry) Register(*Service, ...RegisterOption) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *noopRegistry) Deregister(*Service, ...DeregisterOption) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *noopRegistry) GetService(string, ...GetOption) ([]*Service, error) {
|
|
|
|
return []*Service{}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *noopRegistry) ListServices(...ListOption) ([]*Service, error) {
|
|
|
|
return []*Service{}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *noopRegistry) Watch(...WatchOption) (Watcher, error) {
|
2020-09-03 15:11:05 +03:00
|
|
|
return nil, fmt.Errorf("not implemented")
|
2020-08-29 17:41:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (n *noopRegistry) String() string {
|
|
|
|
return "noop"
|
|
|
|
}
|
|
|
|
|
2020-09-03 15:11:05 +03:00
|
|
|
// newRegistry returns a new noop registry
|
|
|
|
func newRegistry(opts ...Option) Registry {
|
|
|
|
options := NewOptions()
|
|
|
|
|
|
|
|
for _, o := range opts {
|
|
|
|
o(&options)
|
|
|
|
}
|
|
|
|
|
|
|
|
return &noopRegistry{opts: options}
|
2020-08-29 17:41:49 +03:00
|
|
|
}
|