micro/config/source/memory/watcher.go

24 lines
369 B
Go
Raw Normal View History

2019-05-31 01:11:13 +03:00
package memory
import (
"github.com/micro/go-micro/config/source"
)
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
}