2020-08-09 18:17:52 +03:00
|
|
|
// Package noop is a registry which does nothing
|
|
|
|
package noop
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
2020-08-19 17:47:17 +03:00
|
|
|
"github.com/unistack-org/micro/v3/registry"
|
2020-08-09 18:17:52 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
type noopRegistry struct{}
|
|
|
|
|
|
|
|
func (n *noopRegistry) Init(o ...registry.Option) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *noopRegistry) Options() registry.Options {
|
|
|
|
return registry.Options{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *noopRegistry) Register(*registry.Service, ...registry.RegisterOption) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *noopRegistry) Deregister(*registry.Service, ...registry.DeregisterOption) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *noopRegistry) GetService(s string, o ...registry.GetOption) ([]*registry.Service, error) {
|
|
|
|
return []*registry.Service{}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *noopRegistry) ListServices(...registry.ListOption) ([]*registry.Service, error) {
|
|
|
|
return []*registry.Service{}, nil
|
|
|
|
}
|
|
|
|
func (n *noopRegistry) Watch(...registry.WatchOption) (registry.Watcher, error) {
|
|
|
|
return nil, errors.New("not implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n *noopRegistry) String() string {
|
|
|
|
return "noop"
|
|
|
|
}
|
2020-08-09 18:26:51 +03:00
|
|
|
|
|
|
|
// NewRegistry returns a new noop registry
|
|
|
|
func NewRegistry(opts ...registry.Option) registry.Registry {
|
|
|
|
return new(noopRegistry)
|
|
|
|
}
|