feat: introduce Watcher::paths_mut for adding/removing paths in batch#692
feat: introduce Watcher::paths_mut for adding/removing paths in batch#692JohnTitor merged 7 commits intonotify-rs:mainfrom
Watcher::paths_mut for adding/removing paths in batch#692Conversation
|
For context, publishing this change should fix our problem: |
notify/src/lib.rs
Outdated
| /// [#166]: https://github.com/notify-rs/notify/issues/166 | ||
| fn watch(&mut self, path: &Path, recursive_mode: RecursiveMode) -> Result<()>; | ||
|
|
||
| /// Begin to add/remove paths to watch. |
There was a problem hiding this comment.
| /// Begin to add/remove paths to watch. | |
| /// Add/remove paths to watch. |
Yeah, looks cool. Not necessary but adding examples would also be great. |
|
@JohnTitor Test & example added |
|
Seems there are some typos, check CI. |
|
Thanks! But I wanted to double-check that this handles all edge cases appropriately:
|
The second commit ensures the changes since the first one are applied (maybe earlier)
Unspecified behaviour. May or may not be applied depending on the implementation.
Unspecified behaviour. May or may not be applied depending on the implementation. I intentionally leave the semantic of All the doc guarantees is previously added/removed paths are applied after In reality, for FSEvents watcher, the changes aren't applied until |
|
Thank you for merging this. @dfaust will you be able to publish a new release? |
|
Ack, thanks for clarifying @branchseer! For FSEvents, I was mainly concerned that calling For example, If Also: |
|
I didn't notice that I have submitted a fix: #695. @JohnTitor could you help review again? Thank you. |
fixes #3890 (comment). `notify-rs` PR: notify-rs/notify#692
The feature to add / remove paths to watch in batch was introduced in notify-rs#692 There was a problem with the implementation: if you drop the instance without `commit` it may leave the watcher in an inconsistent state (especially fsevents). This commit changes behavior and api and introduces `update_watches` method of the `Watcher` trait, which do the same stuff but in more consistent way. The `paths_mut` method was kept, but returning struct is just a builder for the method `update_watches` that will be called by `PathsMut::commit` related notify-rs#659 closes notify-rs#704
The feature to add / remove paths to watch in batch was introduced in notify-rs#692 There was a problem with the implementation: if you drop the instance without `commit` it may leave the watcher in an inconsistent state (especially fsevents). This commit changes behavior and api and introduces `update_watches` method of the `Watcher` trait, which do the same stuff but in more consistent way. The `paths_mut` method was kept, but returning struct is just a builder for the method `update_watches` that will be called by `PathsMut::commit` related notify-rs#653 closes notify-rs#704
The feature to add / remove paths to watch in batch was introduced in notify-rs#692 There was a problem with the implementation: if you drop the instance without `commit` it may leave the watcher in an inconsistent state (especially fsevents). This commit changes behavior and api and introduces `update_watches` method of the `Watcher` trait, which do the same stuff but in more consistent way. The `paths_mut` method was kept, but returning struct is just a builder for the method `update_watches` that will be called by `PathsMut::commit` related notify-rs#653 closes notify-rs#704
The feature to add / remove paths to watch in batch was introduced in notify-rs#692 There was a problem with the implementation: if you drop the instance without `commit` it may leave the watcher in an inconsistent state (especially fsevents). This commit changes behavior and api and introduces `update_watches` method of the `Watcher` trait, which do the same stuff but in more consistent way. The `paths_mut` method was kept, but returning struct is just a builder for the method `update_watches` that will be called by `PathsMut::commit` related notify-rs#653 closes notify-rs#704
The feature to add / remove paths to watch in batch was introduced in notify-rs#692 There was a problem with the implementation: if you drop the instance without `commit` it may leave the watcher in an inconsistent state (especially fsevents). This commit changes behavior and api and introduces `update_watches` method of the `Watcher` trait, which do the same stuff but in more consistent way. The `paths_mut` method was kept, but returning struct is just a builder for the method `update_watches` that will be called by `PathsMut::commit` related notify-rs#653 closes notify-rs#704
The feature to add / remove paths to watch in batch was introduced in notify-rs#692 There was a problem with the implementation: if you drop the instance without `commit` it may leave the watcher in an inconsistent state (especially fsevents). This commit changes behavior and api and introduces `update_watches` method of the `Watcher` trait, which do the same stuff but in more consistent way. The `paths_mut` method was kept, but returning struct is just a builder for the method `update_watches` that will be called by `PathsMut::commit` related notify-rs#653 closes notify-rs#704
The feature to add / remove paths to watch in batch was introduced in notify-rs#692 There was a problem with the implementation: if you drop the instance without `commit` it may leave the watcher in an inconsistent state (especially fsevents). This commit changes behavior and api and introduces `update_watches` method of the `Watcher` trait, which do the same stuff but in more consistent way. The `paths_mut` method was kept, but returning struct is just a builder for the method `update_watches` that will be called by `PathsMut::commit` related notify-rs#653 closes notify-rs#704
The feature to add / remove paths to watch in batch was introduced in notify-rs#692 There was a problem with the implementation: if you drop the instance without `commit` it may leave the watcher in an inconsistent state (especially fsevents). This commit changes behavior and api and introduces `update_watches` method of the `Watcher` trait, which do the same stuff but in more consistent way. The `paths_mut` method was kept, but returning struct is just a builder for the method `update_watches` that will be called by `PathsMut::commit` related notify-rs#653 closes notify-rs#704
fixes #653.
I can add tests once the added API is agreed upon.