2020-11-08 18:28:33 +00:00
|
|
|
package noop
|
|
|
|
|
|
|
|
import (
|
2021-11-22 13:04:47 +00:00
|
|
|
"errors"
|
|
|
|
|
2020-11-08 18:28:33 +00:00
|
|
|
"google.golang.org/grpc/resolver"
|
|
|
|
|
2021-07-17 20:40:06 +00:00
|
|
|
"go.linka.cloud/grpc/registry"
|
|
|
|
resolver2 "go.linka.cloud/grpc/resolver"
|
2020-11-08 18:28:33 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func New() registry.Registry {
|
|
|
|
return &noop{}
|
|
|
|
}
|
|
|
|
|
2021-09-17 23:39:15 +00:00
|
|
|
type noop struct{}
|
2020-11-08 18:28:33 +00:00
|
|
|
|
|
|
|
func (n noop) ResolverBuilder() resolver.Builder {
|
|
|
|
return resolver2.New(n)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n noop) Init(option ...registry.Option) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n noop) Options() registry.Options {
|
|
|
|
return registry.Options{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n noop) Register(service *registry.Service, option ...registry.RegisterOption) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n noop) Deregister(service *registry.Service, option ...registry.DeregisterOption) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n noop) GetService(s string, option ...registry.GetOption) ([]*registry.Service, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n noop) ListServices(option ...registry.ListOption) ([]*registry.Service, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n noop) Watch(option ...registry.WatchOption) (registry.Watcher, error) {
|
2021-11-22 13:04:47 +00:00
|
|
|
return nil, errors.New("watch not supported")
|
2020-11-08 18:28:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (n noop) String() string {
|
2021-11-22 13:26:05 +00:00
|
|
|
return "noop"
|
2020-11-08 18:28:33 +00:00
|
|
|
}
|