Darwin version of fsnotifier

Hi,

I have written a WSGI application (mainly) for reloading changed Python modules on a request basis using fsnotifier. The reason why I chose fsnotifier was because I knew that it had versions that were cross platform. I started off by writing a version that worked under Windows. I implemented different behaviour depending on file change, create and delete and everything worked perfectly.

Now to the problem. I just started implementing the Darwin version of the WSGI application, and I thought the only thing I had to do was to change the command line to execute the Darwin compatible fsnotifier. But it seems that the output from fsnotifier differs depending on system. Under Windows I get the actions "DELETE", "UPDATE" and "CREATE" followed by the updated file. Under Darwin, on the other hand, I get an action "DIRTY" followed by the directory containing the changed file.

I have checked the source in your GIT repository and the Linux version seems to be implemented to output the same actions as the Windows version. But the Darwin version is not implemented in that manner. So what I've decided to do is to simply write my own version of the Darwin version that should output the same actions as the Linux and Windows versions.

But before I start doing that I just want to check if there is a reason why this was not done in the first place. Did you run into trouble and therefore chose this simpler implementation?

Regards,
Markus Kristo
www.esn.me

2 comments
Comment actions Permalink

Hello Markus,

AFAIK the only alternative to FS Events API is Kernel Queues mechanism which is more complex and resourse intensive. Simpler implementation is just enough for our purposes.

0
Comment actions Permalink

Thanks for the answer!

We solved the problem by extending the existing fsnotifier code for Darwin using the tip described in the Mac OS X Reference Library:

"The simplest way to solve this problem is to take a snapshot directory hierarchy, storing your own copy of the state of the system at a given point in time."

This might not be a good solution on large directory hierarchies, but it suits our needs perfectly.

Regards,
Markus Kristo
www.esn.me

0

Please sign in to leave a comment.