[Unison-hackers] unison and inotify principle

Patrice Espié patrice.espie at art-de-france-export.com
Wed Jun 4 20:42:06 EDT 2008


Hi All,

First of all, I have to tell that I don't understand the language used to
develop unison (OCaml ?). So I will not be able to help is this way. But for
an external tool, why not ...

Concerning Sylvain's design, I fully agree. Using a pipe to send external
notifications to unison should be very efficient (under Linux and Windows,
at least).

Thank's

2008/6/5 Sylvain Le Gall <sylvain at le-gall.net>:

> On 04-06-2008, Benjamin Pierce <bcpierce at cis.upenn.edu> wrote:
> > Hi Sylvain,
> >
> >>> I am a very humble user who just want to comment on this design (take
> >> all of this conditionaly -- if you feel this is just silly, forget
> >> about
> >> it).
> >>
> >> I don't like the idea of the "file which should be a newline-separated
> >> list of paths (relative to the root of the synchronization)".
> >>
> >> My idea is the following:
> >> - use "-repeat FOO" but FOO is a program
> >> - FOO read file scanned by unison on stdin
> >> - if FOO detects a change in a file scanned by UNISON, it writes it on
> >>  stdout
> >>
> >> In this design, unison has just to send absolute filename name to FOO
> >> and wait for FOO to write any notification.
> >
> > I'm all in favor of simplicity, but I'm concerned about a couple of
> > points in this design.
> >
>
> I take the example of inotify, which i know a little bit.
>
> > 1) How is Unison going to hear about added files?
> >
>
> If you ask to monitor a directory, you will get notified of file added
> in this directory (or directory added...).
>
> 1) Let say unison scan directory /A/B.
> 2) unison send "/A/B" to FOO
> 3) FOO ask inotify to watch directory "/A/B"
> 4) user "touch /A/B/c"
> 5) inotify notify FOO that a file "/A/B/c" has been created
> 6) FOO send "/A/B/c" to unison (but doesn't ask for its watching)
> 7) unison take into consideration the new file and apply rules to see if
>   it fits every rules (ignore...)
> 8) if unison is ok to take into account "/A/B/c" it sends "/A/B/c" to
>   FOO (stating that FOO should watch also this file).
>
> This way FOO has only little knowledge of what unison rules are. It just
> need to check for files that unison is asking him...
>
> > 2) Is Unison really going to tell FOO about *every* file it scans?
> > There may be very many of these (I haven't counted, but I'll bet there
> > are more than 100k files in my filesystem).
>
> Inotify can handle 100k files.
> Transfering 100k x average size of a filename through a pipe
> (stdin/stdout for a Unix.open_process) is the fastest communication
> channel on most system.
>
> But you have other options, unison can only tell foo to take into
> consideration directories (i.e. only send directory filename). inotify
> can also watch for changes of file in watched directory.
>
> Last but not least, FOO command line options should be simple and
> standard:
> - "-enc ENC": define filename encoding for data that will be
>  send/receive
> - "-only-dir": watch for changes only on directory
>
> The real advantage of my proposal is that FOO has very little to know
> about unison. FOO is only made to watch file...
>
> You also have the speed argument/power efficiency: unison is waked up
> only when there is a real change (i.e. FOO send a filename). There is no
> regular scan of the file. Scanning a file every now and then is a big
> problem (think of laptop user that don't like their hard drive to be
> spin up every 10 seconds).
>
> Regards,
> Sylvain Le Gall
>
> ps: i am not an expert at all, if you feel this proposal is not good,
> just tell me, i will stop arguing.
>
> _______________________________________________
> Unison-hackers mailing list
> Unison-hackers at lists.seas.upenn.edu
> http://lists.seas.upenn.edu/mailman/listinfo/unison-hackers
>



-- 
Patrice Espie
Art de France Export
总裁

Head office France :
3, rue G. Rossini, 26000 Valence
Tel: +33 4 75 02 27 70 - Mobile: +33 6 33 04 34 23
www.art-de-france-export.com

Shanghai Office :
Victoire - 法艺阁
The Bund Side - Room 3102 - Building N°7
288 Baidu road - Shanghai 200010, China
Tel: +86 21 6332 0787 - Mobile: +86 139 1740 2646
www.victoire.cn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.seas.upenn.edu/pipermail/unison-hackers/attachments/20080604/2256736c/attachment-0001.htm


More information about the Unison-hackers mailing list