watcher.go 384 B

123456789101112131415161718192021222324
  1. package env
  2. import (
  3. "gogs.baozhida.cn/zoie/OAuth-core/config/source"
  4. )
  5. type watcher struct {
  6. exit chan struct{}
  7. }
  8. func (w *watcher) Next() (*source.ChangeSet, error) {
  9. <-w.exit
  10. return nil, source.ErrWatcherStopped
  11. }
  12. func (w *watcher) Stop() error {
  13. close(w.exit)
  14. return nil
  15. }
  16. func newWatcher() (source.Watcher, error) {
  17. return &watcher{exit: make(chan struct{})}, nil
  18. }