-
Notifications
You must be signed in to change notification settings - Fork 215
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
Modify PollWatcher to support pseudo filesystems like sysfs/procfs #396
Conversation
Note that I opted to use the built-in hasher after realizing that the likelihood of collision on human readable content is extremely low, bordering on impossible. See this toy project I created to test that theory: https://github.com/jasta/hash-collisions |
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.
Thanks for following up so fast. I left some minor comments.
Also looks like we're not 1.47 compatible any more with some code. @JohnTitor any preference for keeping/pushing MSRV ? |
I can also drop these extra features if we need to support older rustc for some reason. Again, apologies, I'm new to rust and just exploring as I go here :) |
Also thanks so much for the fast review, I'm loving working in the rust community so far, y'all are great! |
I think it's totally okay to bump MSRV while we're on beta, and we may have another reason to bump MSRV (#395 (comment)) so feel free to do so if it makes sense here :) |
Then we'll bump it to 1.50 for now, so jasta can test against the CI. And we can then change it for #395 if wanted. |
Should be good to go now |
Snuck in another commit that also shows this feature working in practice using /sys/class/net/lo/statistics. I wanted to use this to further test the implementation but also spell out the use case for folks more clearly |
Oh I see the test is failing on windows for predictable reasons, but I'm not sure exactly how we should solve it. The test definitely only works on UNIX systems, but I'm not sure if that includes OS X or not. |
That should do the trick, let's see if that is running on more than linux. (granted the docs about cond comp don't list |
Sorry all, didn't notice that I still left it in a broken state on Windows. Working on fixing this now |
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.
Should be ready to go again but for some reason CI isn't re-running the failing jobs.
Anti-Mining system from github. First PR of a person to a repo has to be approved for every run by owners. |
Hmm weird, now macos and bsd fail for seemingly unrelated reasons. But at least windows builds. |
Can you kick the CI builds to check that they now succeed? I'm anxious to get this PR finally merged so I can stop maintaining my local fork (well, that and I think it will be useful to others of course! 😁 ) |
As you can see this won't help. You could help me out by just rebasing your stuff on top of master, that should resolve the issues with invalid code, as #399 fixed this on master. |
Technically this means that you can now construct an instance of PollWatcher that performs full file contents hashing to augment the mtime comparison. This works well for pseudo filesystems that often don't adhere to durable filesystem metadata norms like accurate file sizes, modification times, etc. Closes notify-rs#391
The example shows how to use this to effectively watch pseudo filesystems like those through sysfs (i.e. /sys/). The example by default will only work on Linux but does demonstrate well that it works where the previous metadata only approach would not. Sample output: Trying "/sys/class/net/lo/statistics/tx_bytes", use `ping localhost` to see changes! watching ["/sys/class/net/lo/statistics/tx_bytes"]... changed: Event { kind: Modify(Data(Any)), paths: ["/sys/class/net/lo/statistics/tx_bytes"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None } changed: Event { kind: Modify(Data(Any)), paths: ["/sys/class/net/lo/statistics/tx_bytes"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None } changed: Event { kind: Modify(Data(Any)), paths: ["/sys/class/net/lo/statistics/tx_bytes"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None } changed: Event { kind: Modify(Data(Any)), paths: ["/sys/class/net/lo/statistics/tx_bytes"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
My mistake, I misread github's feed and thought you had updated the branch. Just rebased and pushed now |
No worries, I'm just a little bit short on time and didn't have the time to try rebasing this correctly. Should've left a note. |
Thanks for hanging in there, I'll make a proper release tomorrow |
This means that you can now construct an instance of PollWatcher that
performs full file contents hashing to augment the mtime comparison.
This works well for pseudo filesystems that often don't adhere to durable
filesystem metadata norms like accurate file sizes, modification times, etc.
Closes #391