mirror of
https://github.com/linka-cloud/grpc.git
synced 2024-11-05 10:46:25 +00:00
61 lines
1.2 KiB
Go
61 lines
1.2 KiB
Go
package noop
|
|
|
|
import (
|
|
"google.golang.org/grpc/resolver"
|
|
|
|
"gitlab.bertha.cloud/partitio/lab/grpc/registry"
|
|
resolver2 "gitlab.bertha.cloud/partitio/lab/grpc/resolver"
|
|
)
|
|
|
|
|
|
func New() registry.Registry {
|
|
return &noop{}
|
|
}
|
|
|
|
type noop struct {}
|
|
|
|
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) {
|
|
return noopWatcher{}, nil
|
|
}
|
|
|
|
func (n noop) String() string {
|
|
return "passthroug"
|
|
}
|
|
|
|
type noopWatcher struct {}
|
|
|
|
func (n noopWatcher) Next() (*registry.Result, error) {
|
|
return ®istry.Result{}, nil
|
|
}
|
|
|
|
func (n noopWatcher) Stop() {}
|
|
|