Threading and Dropbox

I am developing an application that can use Dropbox as storage.

My question is that you can link folders between computers so that more than 1 person can upload / download to / from the same folder.

Should I be worried about ceiling treatment? What happens if a user uploads a file, another person updates the same file. Does dropbox block a file when there is one operation on it? If not, I think I should handle it correctly in my application?

+3


source to share


2 answers


Yes, you need to worry about that.

Dropbox uses optimistic concurrency. Each file has a rev

(revision) that you can reference when uploading the file (for example via /files_put

). So, the basic idea is that rev

when you upload a file, you track , and when you upload a file, you pass this one rev

as a parameter parent_rev

. If the file has been modified in the meantime by another user (via a shared folder) or by the same user (via another device), rev

it will not match. What happens then is dictated by the parameter autorename

. If you specify true

, the file will be renamed to conflict. If you specify false

, the download is complete and your application can decide what to do.



Basically, you cannot prevent users from updating files on multiple devices at the same time, but you can (and should) handle these conflicts in your application, which rev

is what keeps you from losing data.

+3


source


When a conflict occurs, dropbox will make a copy of the file, and the file name contains the date and hostname (for example, for MarkoLaptop as the hostname and Jan 21, 2015 for the conflict date, a file named will be created README.TXT (MarkoLaptop conflicted copy 2015-01-21)

.), So if you can handle this in application, this is great <3



0


source







All Articles