Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Additional OptionsWatcher interface. Didn't actually attempt to use, just an idea.
type FileNotification interface {
IsCreate() bool
IsDelete() bool
IsModify() bool
IsRename() bool
Path() string // relative path to the file
}
type OptionWatcher interface {
Close() error
RemoveWatch(string) error
WatchPath(string, *Options) error
NextNotification() (FileNotification, error)
}
func NewOptionWatcher() (OptionWatcher, error) {
return NewWatcher()
}
func (w *Watcher) NextNotification() (fn FileNotification, err error) {
select {
case fn = <-w.internalEvent:
case err = <-w.Error:
}
return
}
@nathany

This comment has been minimized.

Copy link

nathany commented Oct 27, 2013

@howeyc One of my concerns is what happens when multiple watches have overlapping options, like a recursive watch on a subfolder with a different pattern match?

I'm wondering about the ability to watch multiple paths in a single watcher? Do we really need that. And if so, should some or all of the options be part of NewOptionWatcher() instead?

@nathany

This comment has been minimized.

Copy link

nathany commented Oct 27, 2013

What would the calling code for Next() look like?

Lots of iterator options http://ewencp.org/blog/golang-iterators/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.