Skip to content
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

Allow a custom event mask to be specified for use with the Linux inotify observer #520

Closed
exarkun opened this issue Feb 1, 2019 · 2 comments

Comments

@exarkun
Copy link
Contributor

exarkun commented Feb 1, 2019

If I want to use watchdog as a Python library and I want to receive events other than the ones that watchmedo is interested, I have to jump through a bunch of hoops to get an InotifyObserver which will set or clear values in the event mask given to inotify_c.Inotify.

I want to be able to supply my own mask to InotifyObserver so that I can receive these other events without monkey-patching the watchdog implementation.

An example of an acceptable interface would be:

InotifyObserver(event_mask=my_integer_mask)

Another example that might provide better flexibility would be:

InotifyObserver(emitter_class=MyInotifyEmitterClass)

coupled with the necessary changes to InotifyBuffer so that it passes through an event mask argument, eg

InotifyBuffer(path, recursive, event_mask=my_integer_mask)

with event_mask being passed on to the inotify_c.Inotify instance it creates.

Note that the emitter_class parameter is a generalization of an idea already present in the code (generate_full_events - which is essentially just a parameter to control the behavior of the emitter and the observer doesn't otherwise need to know anything about it).

@MPalarya
Copy link

+1
We encountered this need over at Redis.
Our options for a workaround are not amazing -
patching / reimplementing or overriding non trivial core classes such as the InotifyBuffer..
We even considered switching to the polling observer

@BoboTiG
Copy link
Collaborator

BoboTiG commented May 18, 2023

The feature was done in #989. I'll cut a new release "quite soon" :)

@BoboTiG BoboTiG closed this as completed May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants