Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
add comment

closed as off topic by Walter, MainMa, World Engineer, StuperUser, Doc Brown Oct 22 '12 at 12:04

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 5 down vote accepted

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.

share|improve this answer
    
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. –  Yko Oct 20 '12 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. –  Patkos Csaba Oct 20 '12 at 15:37
add comment

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