diff --git a/registry/noop.go b/registry/noop.go new file mode 100644 index 00000000..4ea2fe7e --- /dev/null +++ b/registry/noop.go @@ -0,0 +1,44 @@ +package registry + +import ( + "errors" +) + +type noopRegistry struct{} + +func (n *noopRegistry) Init(...Option) error { + return nil +} + +func (n *noopRegistry) Options() Options { + return Options{} +} + +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) { + return nil, errors.New("not implemented") +} + +func (n *noopRegistry) String() string { + return "noop" +} + +// NewRegistry returns a new noop registry +func NewRegistry(...Option) Registry { + return &noopRegistry{} +}