Slide 1

Slide 1 text

App Data, Everywhere Leah Culver, Dropbox SXSW 2014

Slide 2

Slide 2 text

Dropbox “Your [digital] stuff everywhere”

Slide 3

Slide 3 text

Wherever you are

Slide 4

Slide 4 text

Safe and secure

Slide 5

Slide 5 text

Share with friends

Slide 6

Slide 6 text

• Filesystem that just works • “The magic folder” Then

Slide 7

Slide 7 text

• Multi-device world • Apps • Mobile storage and sync Now

Slide 8

Slide 8 text

• Cross-platform support • Store data • User auth and permissions • Sync across devices • Offline access Mobile backend challenges

Slide 9

Slide 9 text

Write your own backend API Solution

Slide 10

Slide 10 text

Mobile backend service
 (Parse, iCloud, Dropbox, etc.) Solution

Slide 11

Slide 11 text

Dropbox for your mobile apps

Slide 12

Slide 12 text

Store data in user’s own Dropbox • Free for developers • Access to files outside your app • User owns their data

Slide 13

Slide 13 text

How can I use Dropbox in my app?

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

• List files
 /metadata// • Upload file
 /files_put// • Get a thumbnail
 /thumbnails// • Share via a link
 /shares// Core API

Slide 16

Slide 16 text

Authentication and permissions • Connect with Dropbox • Full or limited access • Only request permissions that
 your app needs

Slide 17

Slide 17 text

Permissions

Slide 18

Slide 18 text

Permissions App folder
 Permission to a specific folder ! File types
 Permission to a class of files (e.g. images) ! Full Dropbox
 Permission to everything

Slide 19

Slide 19 text

Core API is great. So what now?

Slide 20

Slide 20 text

Sync across devices • Files available everywhere • Syncs across devices • Offline access

Slide 21

Slide 21 text

Sync API

Slide 22

Slide 22 text

Sync API (like Core API) • Files for your app in your user’s Dropbox • Store and sync photos, videos, files, etc.

Slide 23

Slide 23 text

• Handles offline caching and syncing • Notifications of changes Sync API

Slide 24

Slide 24 text

Image Grid Sample

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

Image Grid Sample code iOS

Slide 27

Slide 27 text

Initialize the filesystem

Slide 28

Slide 28 text

Listen for changes

Slide 29

Slide 29 text

Display thumbnail

Slide 30

Slide 30 text

Great for files… but what about data?

Slide 31

Slide 31 text

Sync API file system-like interface Datastore API structured data Mobile APIs

Slide 32

Slide 32 text

Bundled together for Android, iOS, OS X

Slide 33

Slide 33 text

Datastore API • Storage for structured data • Like a NoSQL database • Stored in the user’s Dropbox • Not files!

Slide 34

Slide 34 text

account→datastore→table→record→field→value Datastore API

Slide 35

Slide 35 text

Why not files? Monolithic → inefficient syncing Opaque → conflicts

Slide 36

Slide 36 text

Why not files? • Clearly defined structure • More efficient syncing • Advanced conflict resolution

Slide 37

Slide 37 text

Similar to Sync API … • Handles offline caching and syncing • Notifications of changes

Slide 38

Slide 38 text

Click the Box

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

Click the Box code JavaScript

Slide 41

Slide 41 text

Initialize datastore

Slide 42

Slide 42 text

Click listener

Slide 43

Slide 43 text

Listen for changes

Slide 44

Slide 44 text

Display level

Slide 45

Slide 45 text

Take it offline!

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

• Local changes cached when offline • Syncs changes with server when online • Automatically merge changes Offline / online syncing

Slide 48

Slide 48 text

• 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

Slide 49

Slide 49 text

Device A Server Device B Visually 2 r: 2 2 r: 2 2 r: 2

Slide 50

Slide 50 text

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

Slide 51

Slide 51 text

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

Slide 52

Slide 52 text

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

Slide 53

Slide 53 text

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

Slide 54

Slide 54 text

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

Slide 55

Slide 55 text

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

Slide 56

Slide 56 text

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

Slide 57

Slide 57 text

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

Slide 58

Slide 58 text

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

Slide 59

Slide 59 text

• Server rejects delta • Server sends delta to catch up • Client resolves conflict • Client sends new delta • Server accepts new delta Conflict resolution

Slide 60

Slide 60 text

• Changes to different records commute • Deletions win • Changes to the same field are merged Conflict resolution rules

Slide 61

Slide 61 text

Customizable per-field: • Remote (default) - server wins • Local - client wins • Max - greater value wins • Min - lesser value wins • Sum - adds differences together Conflict resolution

Slide 62

Slide 62 text

Custom resolution rule

Slide 63

Slide 63 text

Powerful stuff…

Slide 64

Slide 64 text

• Cross-platform SDKs • Both files and data • Users’ own Dropbox • Handles offline access, sync, and conflict resolution Sync and Datastore APIs

Slide 65

Slide 65 text

Questions? dropbox.com/developers [email protected]

Slide 66

Slide 66 text

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/