-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Distinguish events from files with the same name #193
Distinguish events from files with the same name #193
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the pull request, @initard! This looks reasonable.
Unfortunately the CI build fails, due to #194 (which I've just opened). This would need to be addressed (preferably in a separate pull request) before this one can be merged.
Are you in a hurry to get this merged? We could wait for a while, to get feedback on #194, or we could do the conservative MSRV upgrade right now, to get things going again.
Also apologies for the auto-formatting on the files, I can revert them. Let me know!
This is fine. In fact, it would be better to auto-format the whole code base and enforce the formatting on CI. But please put formatting changes in separate commits in the future. Having them mixed in with actual changes makes those changes needlessly hard to review.
627e2bb
to
ba0f0c6
Compare
Thanks for reviewing so quickly. Not in a hurry, this can wait 😄
I went ahead and turned off auto formatting and removed the linting stuff. It makes the PR clearer. Sorry again! I can make a separate PR for the linting stuff! Happy to help where I can. |
Great 👍 If no feedback on the issue comes for a while, feel free to just submit a PR with an MSRV upgrade to the latest version.
No problem, it wasn't a big deal! If you're willing to sort out the formatting, that would definitely be welcome! It would prevent issues like this in the future. What basically needs to happen, is to run |
ba0f0c6
to
8cb5ebd
Compare
Hey @initard! The MSRV was raised in #196. I've rebased this pull request and re-run the CI build, but it still fails, although for a different reason. Looks like some test code fails to compile. Could you have a look? |
8cb5ebd
to
3827026
Compare
- add `get_watch_descriptor_id` method to `WatchDescriptor` enabling inotify events to be distinguished (on id) by the crate user Signed-off-by: initard <alex.solomes@softwareag.com>
- add test to check that two files with the same name yet coming from different paths can be distinguished. Signed-off-by: initard <alex.solomes@softwareag.com>
3827026
to
760a156
Compare
Hi @hannobraun! Apologies for the wait. I updated the tests — it was an issue with the feature flags for the "stream" feature. Can you please try again? As you can see from the linked issue above (thin-edge/thin-edge.io#1453), our team ran into this exact issue recently and it would be nice to have this merged.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @initard! Everything works great now.
I noticed there was also an API change (
.add_watcher
and.event_stream
were changed), so I hope this PR is still relevant.
I believe those changes are orthogonal, so this PR should be just as relevant as it was before.
Describe the issue
Hi!
While using this API I found myself unable to distinguish between events that arrive from files with the same name yet in different paths. The problem can be formalised as below.
Given two file watchers with the same file name but in different paths:
file watch 1: /tmp/file_a
file watch 2: /tmp/another_dir/file_a
And randomly triggering an event on one of the files. For which file was the event triggered?
Proposed changes
This PR proposes a getter method for the
WatchDescriptor
, allowing one the ability to store the id for a given file watch after an.add_watch()
and using this to compare theEvent
struct coming from an event stream.As a side note, I am still learning Rust so if I used something where perhaps something else was better let me know and I am happy to make the changes! Also apologies for the auto-formatting on the files, I can revert them. Let me know! Thanks