github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/core/cache/watcher.go (about)

     1  // Copyright 2018 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package cache
     5  
     6  import (
     7  	"gopkg.in/juju/worker.v1"
     8  )
     9  
    10  // The watchers used in the cache package are closer to state watchers
    11  // than core watchers. The core watchers never close their changes channel,
    12  // which leads to issues in the apiserver facade methods dealing with
    13  // watchers. So the watchers in this package do close their changes channels.
    14  
    15  // Watcher is the common methods
    16  type Watcher interface {
    17  	worker.Worker
    18  	// Stop is currently needed by the apiserver until the resources
    19  	// work on workers instead of things that can be stopped.
    20  	Stop() error
    21  }
    22  
    23  // NotifyWatcher will only say something changed.
    24  type NotifyWatcher interface {
    25  	Watcher
    26  	Changes() <-chan struct{}
    27  }