add config
This commit is contained in:
23
config/source/memory/watcher.go
Normal file
23
config/source/memory/watcher.go
Normal file
@@ -0,0 +1,23 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user