micro/registry/noop.go
Vasiliy Tolstov dd8894e673 registry: add noop registry
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-08-29 17:41:49 +03:00

45 lines
852 B
Go

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{}
}