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