1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-01-05 10:20:53 +02:00
go-micro/config/source/memory/watcher.go
2023-04-26 02:16:34 +02:00

24 lines
359 B
Go

package memory
import (
"go-micro.dev/v4/config/source"
)
type watcher struct {
Updates chan *source.ChangeSet
Source *memory
Id string
}
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
}