micro/config/source/memory/watcher.go
Asim Aslam 563768b58a
v3 refactor (#1868)
* Move to v3

Co-authored-by: Ben Toogood <bentoogood@gmail.com>
2020-07-27 13:22:00 +01:00

24 lines
372 B
Go

package memory
import (
"github.com/micro/go-micro/v3/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
}