Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the DropBox Mac client work?

I've been looking at the DropBox Mac client and I'm currently researching implementing a similar interface for a different service.

How exactly do they interface with finder like this? I highly doubt these objects represented in the folder are actual documents downloaded on every load? They must dynamically download as they are needed. So how can you display these items in finder without having actual file system objects?

Does anyone know how this is achieved in Mac OS X?

Or any pointer's to Apple API's or other open source projects that have a similar integration with finder?

like image 760
Brian Gianforcaro Avatar asked Oct 09 '08 00:10

Brian Gianforcaro


People also ask

What is the Dropbox client?

You can search for your folders, files, and storage on the Dropbox website. Dropbox is a simple and one of the most reliable file-syncing storage service providers with features like collaboration, cloud storage, compatibility, security, privacy, etc.

Does Dropbox have a Mac app?

The Dropbox desktop application is available for Windows, Mac, and Linux operating systems.


2 Answers

Dropbox is not powered by either MacFUSE or WebDAV, although those might be perfectly fine solutions for what you're trying to accomplish.

If it were powered by those things, it wouldn't work when you weren't connected, as both of those rely on the server to store the actual information and Dropbox does not. If I quit Dropbox (done via the menu item) and disconnect from the net, I can still use the files. That's because the files are actually stored here on my hard drive.

It also means that the files don't need to be "downloaded on every load," since they are actually stored on my machine here. Instead, only the deltas are sent over the wire, and the Dropbox application (running in the background) patches the files appropriately. Going the other way, the Dropbox application watches for the files in the Dropbox folder, and when they change, it sends the appropriate deltas to the server, which propagates them to any other clients.

This setup has some decided advantages: it works when offline, it is an order of magnitude faster, and it is transparent to other apps, since they just see files on the disk. However, I have no idea how it deals with merge conflicts (which could easily arise with one or more clients offline), which are not an issue if the server is the only copy and every edit changes that central copy.

Where Dropbox really shines is that they have an additional trick that badges the items in the Dropbox folder with their current sync status. But that's not what you're asking about here.

As far as the question at hand, you should definitely look into MacFUSE and WebDAV, which might be perfect solutions to your problem. But the Dropbox way of doing things, with a background application changing actual files on the disk, might be a better tradeoff.

like image 135
TALlama Avatar answered Oct 09 '22 03:10

TALlama


Dropbox is likely using FSEvents to watch for changes to the file system. It's a great API and can even bundle up changes that happened while your app was not running. It's the same API that Spotlight uses. The menubar app likely does the actual observing itself (since restarting it can fix uploads being hung, for instance).

There's no way they're using MacFUSE, as that would require installing the MacFUSE kernel extension to make Dropbox work, and since I definitely didn't install it, I highly doubt they're using it.

like image 36
Colin Barrett Avatar answered Oct 09 '22 02:10

Colin Barrett