开发者

How get delta from single file?

Dropbox is using delta encoding algorithm to find difference between two files, first is modified file and second is old file. But where they are storing old file, how they can find difference because they have开发者_JS百科 only new file, they didn't have old file. It's not possible to firstly download file from server and then find difference, which method they are using?


according to this post by a dropbox employee, it would seem they keep that sort of data resident in memory:

Dropbox keeps metadata about your files in RAM to prevent expensive database access during syncing. The metadata includes paths to files in your Dropbox, checksums, modification times, etc. We are working hard on making this information more compact and are working on several fronts to improve memory usage. Our techniques are not limited to rewriting pieces of Python and writing custom memory allocators :-).

To do this I would guess they have some sort of special handler that allows them to do the delta diff when the user copies the file into the dropbox folder(s). for that, something like the FileSystemWatcher class from .Net would do the trick along with your own pass-through shell copy handler (so you can keep a temp copy of the file till the diff is done, if one needs to be done).

Also, as a side note, dropbox is written in python and wxWdigets.


some sites you might find useful for delta compression:

  • xdelta
  • bsdiff
  • wikipedia's page
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜