1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-24 10:07:04 +02:00
go-micro/registry/memory/memory_watcher.go

28 lines
415 B
Go
Raw Normal View History

2019-01-14 17:27:25 +02:00
package memory
2016-04-26 19:32:43 +02:00
import (
"errors"
"github.com/micro/go-micro/v2/registry"
2016-04-26 19:32:43 +02:00
)
2019-01-14 17:27:25 +02:00
type memoryWatcher struct {
2016-04-26 19:32:43 +02:00
exit chan bool
2018-02-19 19:12:37 +02:00
opts registry.WatchOptions
2016-04-26 19:32:43 +02:00
}
2019-01-14 17:27:25 +02:00
func (m *memoryWatcher) Next() (*registry.Result, error) {
2016-04-26 19:32:43 +02:00
// not implement so we just block until exit
<-m.exit
return nil, errors.New("watcher stopped")
2016-04-26 19:32:43 +02:00
}
2019-01-14 17:27:25 +02:00
func (m *memoryWatcher) Stop() {
2016-04-26 19:32:43 +02:00
select {
case <-m.exit:
return
default:
close(m.exit)
}
}