-
Notifications
You must be signed in to change notification settings - Fork 0
/
noop.go
51 lines (40 loc) · 1.05 KB
/
noop.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Package noop is a registry which does nothing
package noop
import (
"github.com/micro/go-micro/cmd"
"github.com/micro/go-micro/registry"
)
type noopRegistry struct {
options registry.Options
}
func init() {
cmd.DefaultRegistries["noop"] = NewRegistry
}
func (m *noopRegistry) Options() registry.Options {
return m.options
}
func (m *noopRegistry) GetService(service string) ([]*registry.Service, error) {
return nil, nil
}
func (m *noopRegistry) ListServices() ([]*registry.Service, error) {
return nil, nil
}
func (m *noopRegistry) Register(s *registry.Service, opts ...registry.RegisterOption) error {
return nil
}
func (m *noopRegistry) Deregister(s *registry.Service) error {
return nil
}
func (m *noopRegistry) Watch(opts ...registry.WatchOption) (registry.Watcher, error) {
return &noopWatcher{exit: make(chan bool)}, nil
}
func (m *noopRegistry) String() string {
return "noop"
}
func NewRegistry(opts ...registry.Option) registry.Registry {
var options registry.Options
for _, o := range opts {
o(&options)
}
return &noopRegistry{options}
}