Re: Best Technique for Watched folders ?
Re: Best Technique for Watched folders ?
- Subject: Re: Best Technique for Watched folders ?
- From: Jean-Daniel Dupas <email@hidden>
- Date: Tue, 5 May 2009 23:41:58 +0200
Le 5 mai 09 à 22:04, Mark Gilbert a écrit :
Folks.
For the 3rd time in my life I am about to start writing folder
watching code.
It's one of those things thats easy to do in a half hearted manner,
but somewhat complicated to do in an efficient and comprehensive way.
I thought I might canvas some ideas from other people before I
embark on this next generation.
The key issues seem to be:
- What are we watching for ? - new files, changed files ? renamed
files ?
- How do we find them ? - bulk search, iteration ?
- How do we know which ones have already been processed ? - mod
date ? some kind of flag ?
- How do we know when its safe to 'trigger' on a file which is being
written into the folder ?
- What happens as our folder gets full up....?
- How do we do all this efficiently without hammering the file
system or the CPU ?
I have my own ideas on some of these things, but I wanted to see if
anyone else had a strong point of view.
In particular whether its a good plan to mark files in some way, and
whether this can be keyed automatically into the discovery process.
Also, what is the best discovery process ? I am sure Apple would
tell us to use event notifications rather than polling the folder,
but I have not had much luck figuring out what can be notified and
how.
I can give you an answer at least about notifications. You can use
either the FSEvent API or kevent/kqueue API (or a launchd task and let
launchd watching the folder for you).
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden