Upgrade to Pro — share decks privately, control downloads, hide ads and more …

App Data, Everywhere: Cross-Device Content Sharing

App Data, Everywhere: Cross-Device Content Sharing

We live in a cross-platform world, with users now expecting the data they create to follow them across various devices, browsers and even offline. Consumers’ data sync demands range from simple needs (i.e. accessing the most up-to-date documents anywhere) to more complicated scenarios (such as picking up a game right where it was left off on another device). As user demand for easy access to content from any device grows, managing data has moved from a pure storage problem to one of data synchronization.

SXSW, March 9, 2014
http://schedule.sxsw.com/2014/events/event_IAP23904

Leah Culver

March 09, 2014
Tweet

More Decks by Leah Culver

Other Decks in Programming

Transcript

  1. • Cross-platform support • Store data • User auth and

    permissions • Sync across devices • Offline access Mobile backend challenges
  2. Store data in user’s own Dropbox • Free for developers

    • Access to files outside your app • User owns their data
  3. Core API • REST-ish, OAuth 2.0, JSON • Android, iOS,

    OS X, Python, Ruby, Java, PHP • Community-supported libraries for C#, JavaScript, Perl, etc. HTTP API for files
  4. • List files
 /metadata/<root>/<path> • Upload file
 /files_put/<root>/<path> • Get

    a thumbnail
 /thumbnails/<root>/<path> • Share via a link
 /shares/<root>/<path> Core API
  5. Authentication and permissions • Connect with Dropbox • Full or

    limited access • Only request permissions that
 your app needs
  6. Permissions App folder
 Permission to a specific folder ! File

    types
 Permission to a class of files (e.g. images) ! Full Dropbox
 Permission to everything
  7. Sync API (like Core API) • Files for your app

    in your user’s Dropbox • Store and sync photos, videos, files, etc.
  8. Datastore API • Storage for structured data • Like a

    NoSQL database • Stored in the user’s Dropbox • Not files!
  9. Why not files? • Clearly defined structure • More efficient

    syncing • Advanced conflict resolution
  10. Similar to Sync API … • Handles offline caching and

    syncing • Notifications of changes
  11. • Local changes cached when offline • Syncs changes with

    server when online • Automatically merge changes Offline / online syncing
  12. • List of changes - “delta” • Client sends delta

    with “parent revision” on sync • Server rejects a delta if parent revision doesn’t match • Server sends list of deltas to catch up • Client resolves conflict, sends new delta Conflict resolution
  13. Device A Server Device B Visually 2 r: 2 2

    r: 2 2 r: 2 2 r: 2 2 r: 2 3 r: 2
  14. Device A Server Device B Visually 2 r: 2 2

    r: 2 2 r: 2 3 r: 3 3 r: 3 2 r: 2 2 r: 2 3 r: 2
  15. Device A Server Device B Visually 2 r: 2 2

    r: 2 2 r: 2 3 r: 3 3 r: 3 2 r: 2 2 r: 2 3 r: 2 4 r: 2
  16. Device A Server Device B Visually 2 r: 2 2

    r: 2 2 r: 2 3 r: 3 3 r: 3 2 r: 2 2 r: 2 3 r: 2 4 r: 2 3 r: 3 3 r: 3 4 r: 2
  17. Device A Server Device B Visually 2 r: 2 2

    r: 2 2 r: 2 3 r: 3 3 r: 3 2 r: 2 2 r: 2 3 r: 2 4 r: 2 3 r: 3 3 r: 3 4 r: 2 3 r: 3 3 r: 3 * r: 2
  18. Device A Server Device B Visually 2 r: 2 2

    r: 2 2 r: 2 3 r: 3 3 r: 3 2 r: 2 2 r: 2 3 r: 2 4 r: 2 3 r: 3 3 r: 3 4 r: 2 3 r: 3 3 r: 3 * r: 2 * Client resolves to new delta
  19. Device A Server Device B Visually 2 r: 2 2

    r: 2 2 r: 2 3 r: 3 3 r: 3 2 r: 2 2 r: 2 3 r: 2 4 r: 2 3 r: 3 3 r: 3 4 r: 2 3 r: 3 3 r: 3 * r: 2 * Client resolves to new delta 3 r: 3 3 r: 3 4 r: 3
  20. Device A Server Device B Visually 2 r: 2 2

    r: 2 2 r: 2 3 r: 3 3 r: 3 2 r: 2 2 r: 2 3 r: 2 4 r: 2 3 r: 3 3 r: 3 4 r: 2 3 r: 3 3 r: 3 * r: 2 * Client resolves to new delta 3 r: 3 3 r: 3 4 r: 3 4 r: 4 3 r: 3 4 r: 4
  21. Device A Server Device B Visually 2 r: 2 2

    r: 2 2 r: 2 3 r: 3 3 r: 3 2 r: 2 2 r: 2 3 r: 2 4 r: 2 3 r: 3 3 r: 3 4 r: 2 3 r: 3 3 r: 3 * r: 2 * Client resolves to new delta 3 r: 3 3 r: 3 4 r: 3 4 r: 4 3 r: 3 4 r: 4 4 r: 4 4 r: 4 4 r: 4
  22. • Server rejects delta • Server sends delta to catch

    up • Client resolves conflict • Client sends new delta • Server accepts new delta Conflict resolution
  23. • Changes to different records commute • Deletions win •

    Changes to the same field are merged Conflict resolution rules
  24. Customizable per-field: • Remote (default) - server wins • Local

    - client wins • Max - greater value wins • Min - lesser value wins • Sum - adds differences together Conflict resolution
  25. • Cross-platform SDKs • Both files and data • Users’

    own Dropbox • Handles offline access, sync, and conflict resolution Sync and Datastore APIs
  26. Photos http://www.flickr.com/photos/kky/704056791/ http://www.flickr.com/photos/ianmalcm/3829590116/ http://www.flickr.com/photos/doug88888/3130802503/ http://www.flickr.com/photos/eulothg/5906431611/ http://www.flickr.com/photos/tambako/2844515466/ http://www.flickr.com/photos/7447470@N06/2059257387/ http://www.flickr.com/photos/billy_wilson/4123838868/ http://www.flickr.com/photos/yourdon/10018150113/ http://www.flickr.com/photos/mager/2659619029/

    http://www.flickr.com/photos/ben_grey/4582294721/ http://www.flickr.com/photos/adactio/12674602864/ http://www.flickr.com/photos/mako_side_b/2332323845/ http://www.flickr.com/photos/coofdy/11492948263/ http://www.flickr.com/photos/arts/42217172/ http://www.flickr.com/photos/drachmann/327122302/ http://www.flickr.com/photos/evergreenkamal/395448039/ http://www.flickr.com/photos/aliaholle/5888906660/ http://www.flickr.com/photos/vinothchandar/5148046888/