github.com/annwntech/go-micro/v2@v2.9.5/config/source/memory/watcher.go (about) 1 package memory 2 3 import ( 4 "github.com/annwntech/go-micro/v2/config/source" 5 ) 6 7 type watcher struct { 8 Id string 9 Updates chan *source.ChangeSet 10 Source *memory 11 } 12 13 func (w *watcher) Next() (*source.ChangeSet, error) { 14 cs := <-w.Updates 15 return cs, nil 16 } 17 18 func (w *watcher) Stop() error { 19 w.Source.Lock() 20 delete(w.Source.Watchers, w.Id) 21 w.Source.Unlock() 22 return nil 23 }