Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WatchEvent ¶
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher is a code monitor for multiple projects
func NewWatcher ¶
func NewWatcher(pub *pubsub.ElemPublisher) *Watcher
NewWatcher creates a watcher instance.
func (*Watcher) Add ¶
func (w *Watcher) Add(ws *WatcherSet) error
Add adds a set of files to a watcher.
func (*Watcher) Dispose ¶
func (w *Watcher) Dispose()
Dispose stops the go-routine of this watcher and releases all resources used by this watcher
func (*Watcher) Start ¶
Start starts a new go-routine that monitors the watcher set and publishes an event when there's code change. Start returns an error channel. Whenever an error occurs within Start, that error will be fed into the error channel. Start and its goroutine will then return, leaving the error channel with only the last error that occurred If there is no error, checking the channel will return a nil value Errors will occur under the following circumstances: there is already a Start goroutine running fsnotify could not create a fileWatcher filepath could not perform a walk of the target project a directory cannot be added to the filewatcher filewatcher failed in reported/receiving an event goroutine failed to get info about the file/directory In the case of an error, the returned channel will close
type WatcherSet ¶
type WatcherSet struct { Name string `yaml:"name" json:"name"` // Name is the name of this set Watch []string `yaml:"watch" json:"watch"` // A list of glob patterns to watch }
WatcherSet is a set of directories or files to watch.