BT

Dropbox Now Can Hold Structured Data with Datastore API

by Abel Avram on Jul 11, 2013 |

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.

Hello stranger!

You need to Register an InfoQ account or 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

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT