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