UbuntuOneFiles

Differences between revisions 1 and 2
Revision 1 as of 2012-09-30 04:24:24
Size: 3910
Editor: 87-206-20-76
Comment: Initial documentation. Added new local file, local file changed and local file deleted use cases.
Revision 2 as of 2012-09-30 04:26:24
Size: 4085
Editor: 87-206-20-76
Comment: Added general settings.
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:

== General settings ==

 * Allow different connection types to be used by sync
  * WiFi
  * Bluetooh
  * WiMAX
  * Mobile
 * Allow specifying max file size to sync.

Ubuntu One Files - Android application providing access to Ubuntu One cloud storage.

Sync

This section is intended to document future sync logic of Ubuntu One Files Awesome! B)

This section assumes locally cached file meta data is up-to-date, unless stated otherwise.

General settings

  • Allow different connection types to be used by sync
    • WiFi

    • Bluetooh
    • WiMAX
    • Mobile
  • Allow specifying max file size to sync.

Device to Ubuntu One - local to remote sync

(i) When talking about local to remote sync, you can use the sync-up term. Refers to all logic responsible for making server storage reflect local changes.

Any .u1conflict creation needs to be notified to the user.

New local file

NEW LOCAL FILE [1]
   |
    --- Local file within cached/synced location?
      /\ Yes
     |  --- File under same path exist on the server already?
     |    /\ Yes
     |   |  --- Move local file to local file .u1conflict.
     |   | No
     |    --- Upload local file.
     | No
      --- Ignore.

[0] We assume the file does not come from U1F cache. App clear data/reinstall has to be considered. TODO

[1] Because we don't sync all files, not all files in U1 cloud will be stored on the device. Thus, if we detect a new local file under an already existing resource path, we immediately move that file to .u1conflict, see [0].

Local file changed

(i) We only scan for changes on files, that have been:

  • cached?
  • selected explicitly for sync?

By Design team, files which have been downloaded should be kept in sync. That makes sense, but can't be easily generalized to directories. What if a new file appears within an not-synced directory, do we ignore that?

LOCAL FILE CHANGED [0,1]
   |
    --- Does cached file hash match the server hash right now? [2]
      /\ Yes
     |  --- Overwrite remote file with local file.
     | No
      --- Move local file to .u1conflict

[0] File changes are detected only for files mentioned in (i) above.

[1] How change is detected:

  • If last modification date has not been saved, save last modification time and treat as new file for upload. TODO Reconsider this. Upload all files?

  • Upon any next scan, IFF saved last modification date is different than file last modification date, treat as candidate for upload (think in terms of potential .u1conflict).
  • Do NOT trust local device time. Never.

[2] Requires persisting cached hash as $hash, getNode() to refresh local cache, and compare hash with $hash.

Local file deleted

(i) We only scan for changes on files, that have been:

  • cached

LOCAL FILE DELETED [0]
   |
    --- SYNC LOCAL DELETIONS setting set to true?
      /\ Yes
     |  --- Is this a directory?
     |    /\ Yes
     |   |  --- Delete the remote directory'''?'''
     |   | No
     |    --- Delete the remote file.
     | No
      --- Ignore.

[0] This MUST consider storage being temporarily unmounted, which is not equivalent of having local files removed. Toggling "Sync local deletions" setting could display a dialog to the user warning about custom storages, which the user is able to unmount.

Ubuntu One to device - remote to local sync

(i) When talking about remote to local sync, you can use the sync-down term. Refers to all logic responsible for making client storage reflect server changes.

Remote file deleted

(X) Never assume you can delete a local directory recursively, if it has been deleted remotely. User may have stored some random files within it locally in the mean time, before local scan has picked them up. Delete files using exact paths only, alternatively delete the directories in DFS manner if the root directory has no files left.

Implementation phases

(1) phase: sync-up complete

(2) phase: sync-down complete

(1) + (2) - sync working

(3) phase: GCM supporting sync-down

{4} phase: Android 4.0+ MediaStore.Files supporting sync-up

UbuntuOne/Android/UbuntuOneFiles (last edited 2012-10-02 19:57:12 by bas5-kingston08-1177885941)