2

I was looking into lipsync on a Dropbox clone. I was looking at the diagram on how it works here.

It shows that a cronjob is used to keep files in sync between client and server. Does that mean that every sec/min/hour, a cronjob runs and checks to see if there is a difference between client and server? Is that how Dropbox does it?

If it does use a cronjob, what happens when you are in the middle of syncing and another cronjob runs? Does rsync (or additional libs) know how to handle this?

1 Answer 1

6

No, Dropbox and any decent synchronization tool relies on file system events. All operating systems offer such events and programs like Dropbox are just simply listening for changes on files they are watching. When a change happens, or file is added / deleted, Dropbox decides what it has to do.

If several events happen while others are in progress, they a queued and executed sequentially, or parallel where possible.

EDIT: for Linux see the inofity file system event system.

2
  • i'll check out inofity. i watch a talk by one of their engineers that they have a single codebase in python. so, if i were to use something like inofity, will it only work for linux? or is the general idea is that you use inofity for linux, mac for mac, windows for windows but still share a single general codebase.
    – oky_sabeni
    Commented Oct 20, 2012 at 15:01
  • 1
    There are libraries that implement a single interface for different operating systems. For example, Ruby's whatchr works both on Windows, Linux, MacOS, Solaris, etc. On each system it uses the solution offered by the OS or filesystem. On Linux it is inotify(), on MacOS it is fsevents(), on Solaris it is ZFS FSE, on Windows I don't know. There is usually always a fallback solution for exotic systems where a daemon periodically polls the files or directories state and compares it with a previous one. Commented Oct 20, 2012 at 15:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.