notify icon indicating copy to clipboard operation
notify copied to clipboard

Filtered recursive watchers

Open mystor opened this issue 5 years ago • 1 comments

Currently if the Recursive bit is specified, every sub-directory of the specified directory will be watched unconditionally.

In some situations, it's possible to exclude entire directories, potentially with many files (e.g. build artifacts), from the watcher. For some backends, I imagine that this wouldn't provide much benefit, as they natively support recursive watching, but for others it may be much cheaper if the directory is ignored completely.

It would be awesome if the RecursiveMode enum could be extended with a filter callback, which would have to run quickly and be callable from any thread, for example:

type Filter = dyn Fn(&Path) -> bool + Send + Sync;
enum RecursiveMode {
    NonRecursive,
    Recursive,
    RecursiveFiltered(Box<Filter>),
}

It may be worthwhile to also filter events with this callback, but it's also probably fine if occasionally events are delivered for "filtered" paths. :woman_shrugging:

mystor avatar Jun 02 '19 16:06 mystor

There's actually another concurrent idea and partial implementation that was explored recently, see #175. I'm definitely open to it.

passcod avatar Jun 02 '19 23:06 passcod