2019-05-30 23:11:13 +01:00
|
|
|
package memory
|
|
|
|
|
|
|
|
import (
|
2020-08-19 17:47:17 +03:00
|
|
|
"github.com/unistack-org/micro/v3/config/source"
|
2019-05-30 23:11:13 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type watcher struct {
|
|
|
|
Id string
|
|
|
|
Updates chan *source.ChangeSet
|
|
|
|
Source *memory
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *watcher) Next() (*source.ChangeSet, error) {
|
|
|
|
cs := <-w.Updates
|
|
|
|
return cs, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *watcher) Stop() error {
|
|
|
|
w.Source.Lock()
|
|
|
|
delete(w.Source.Watchers, w.Id)
|
|
|
|
w.Source.Unlock()
|
|
|
|
return nil
|
|
|
|
}
|