BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Dropbox Now Can Hold Structured Data with Datastore API

| by Abel Avram Follow 4 Followers on Jul 11, 2013. Estimated reading time: 1 minute |

Dropbox has released Datastore API which provides access to key-value stores with support for synchronization between devices using the user’s Dropbox account and including automatic conflict resolution.

Datastore API allows applications to store structured data in user’s Dropbox account, with built-in support for synchronizing changes between various devices and automatic conflict resolution. The API supports offline activities, operating updates when the Internet connection is back.

A Datastore is organized in tables which contain records consisting of an ID and a set of fields. Each field has a name and a value. Supported value types are:

  • String
  • Boolean
  • Integer. 64 bits, signed
  • Floating point. IEEE double
  • Date. POSIX millisecond timestamp
  • Bytes. Binary data such as images or compressed data. Since each record has a size limit of 100KB, storing larger amounts of data can be done by using Dropbox files accessed through Sync API. The field would contain a reference to the file.
  • List. A list of above mentioned values. It cannot contain other lists. They support basic operations: put, move, insert, and delete.

The datastore does not have a schema, allowing records with different number of fields, but it is recommended for “all the records in a table to have roughly the same fields so you can query over them.” Multiple tables and datastores can be created to accommodate developer’s needs.

An application is limited to 5MB across all its datastores without using a user’s storage quota. Above that limit, the application starts using the user’s Dropbox quota, and writing no longer works if its limit is reached.

Following is an Android sample showing how to open the default datastore, create a new table, insert a new record having two fields, taskname and completed, then sync the in-memory data with Dropbox.

DbxDatastore store = DbxDatastore.openDefault(mAccount);
DbxTable tasksTbl = store.getTable("tasks");
DbxRecord firstTask = tasksTbl.insert().set("taskname", "Buy milk").set("completed", false);
store.sync();

Registered listeners will be informed when a sync operation takes place so they can proceed as needed. This is how datastore operations are propagated among devices.

Dropbox provides SDKs for Android, iOS and JavaScript. Although the API is in beta, Dropbox expects “the API to be stable in a few weeks.”

Dropbox has supplied an iOS Sync Component for Xamarin enabling datastore access from C#. A demo video set up by Xamarin shows how quickly changes are propagated between devices.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT