[Development] QFileSystemWatcher and Recursive Monitoring

d3fault d3faultdotxbe at gmail.com
Tue Jul 24 09:50:37 CEST 2012


On Jul 23, 2012 11:49 PM, "Sylvain Pointeau" <sylvain.pointeau at gmail.com>
wrote:
> I really like the idea of 1 signal and use the best as possible of each
OS. I am against Qt to make a snapshot of the directory because it will not
be done efficiently, means that this code, to be efficient, depends on the
task to achieve, and there is probably a ton of optimisations that we can
apply in a particular context.
>

It will only be inefficient for the few platforms that don't support the
functionality. The cost for platforms that already do provide the
functionality is zero.

Filesystem notifications are a pretty basic piece of functionality, and
having them be 100% cross platform would be a huge win for Qt.

>
> Maybe create a separate to provide a helper of creating a snapshot? In
this case I would suggest using a sqlite database and not the memory.
Memory is definitly a showstopper.
>

Theoretically it could be either (user chooses memory or sqlite) or both
(fixed size memory cache with sqlite storing the rest) or neither (when the
user wants to maintain the snapshot themselves (but remember, this is only
applicable to the platforms that DON'T support fine grained fs event
notifications. All these options are n/a to the platforms that do) because
they can perform context sensitive optimizations as you mentioned)... but
uhh I'm willing to bet sqlite would be a lot slower since now there's a hdd
read/write. Would save memory though if that's your concern. It's just
added design complexity which I'm guessing regedit doesn't want to deal
with. It's already getting complex enough.

Can any Qt devs comment on whether QFsw would even be allowed in Qt in a
non cross-platform state (ignoring the fact that pretty much any solution
is better than the current Qt release's solution lol)? regedit, you might
find it doesn't pass code review... but maybe the capabilities() hack is
enough, idk (i still wouldn't recommend it)...

d3fault

p.s. just thought of this: you could specify what properties in the
snapshot you want to be compared as an optimization (enum flags
filter)..... but then there's the cross platform breaking use case where
you use the optimization just described to purposefully get less
notifications (say... ignore filename changes but tell me about file size
changes (all using some enum flag filter mechanism))... but when you run
that code on a platform that doesn't need the snapshot logic, you'll still
receive filename changed events (unless your setting of said enum flag
filters activates snapshot comparison mode... which isn't there because
it's #ifdef'd out on this platform (and so shouldn't be)). Bah, this
optimization sucks.... but it's still better than forcing every _user_ app
to do it manually every time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120724/72ba4aec/attachment.html>


More information about the Development mailing list