U1DB: Canonical’s Platform-Agnostic Data Synchronisation Solution

U1DB: Canonical’s Platform-Agnostic Data Synchronisation Solution

A large number of people today use multiple devices in their everyday work. Often times, you need access to the same kind of data on multiple devices.

Numerous synchronization solutions have sprung up recently, DropBox, SugarSync, SpiderOak etc. Some of them offer synchronization across computers and devices. If you use some kind of synchronization solution, which folder(s) do you synchronize? What do you place in this folder? Chances are you will not be able to synchronize all you data because there is no single location that stores all your data really.

Most software we use have their own locations for storing their data, so your data is actually all over the place. For example, you’d probably want your contacts accessible from both you mobile, and desktop. However something like DropBox is of limited use in that scenario.

The same is true of a lot of data. You probably need to use the same bookmarks, passwords, etc on all your computes, so browsers offer synchronization solutions for that. Firefox, Chrome and Opera each have an independent solution for this data. Why should each software have to reinvent the wheel? Why create an entire sync platform for each new software?

It is infeasible to use something like DropBox to synchronize your Firefox profile across Windows and Linux since some of your profile data is platform-sensitive. Yet there is a lot of data there that is relevant across browsers. It is easy enough to synchronize your documents across OSs and have them open in Microsoft Office on Windows and LibreOffice on Linux, but for applications settings, metadata etc. it is a different story even if the same software is in use across platforms. Thanks to the different structures of Windows, Linux and Mac OSX one cannot simply sync application settings.

What is needed is a pluggable synchronization system that provides a basic synchronization service, which can then be used by other applications to for syncing arbitrary data across computers, not just files. The Ubuntu One “U1DB” API is one such solution being worked on by Canonical.

Microsoft’s own free synchronization solution, Live Mesh, offered with their Live services is capable of synchronizing application data, but only supports a few Microsoft applications, Internet Explorer, and Microsoft Office out of the box. Microsoft does have their Sync Framework Toolkit which makes it easier for developers to add synchronization features in their apps. Being a Microsoft technology though, it isn’t as portable, and supports a limited number of programming languages and platforms.

What Canonical has created with U1DB is not a database, but a database synchronization solution. It is agnostic of the platform it is running on, the language it coded in and the database used to store the actual data. It is intended to be a common ground; something that can be implemented anywhere such that developers can easily create software that supports synchronization of its internal configuration and structure.

Because it is agnostic of the database used for storage and the programming language used to build the app, it would be possible for one to build a U1DB a desktop U1DB app that uses SQLite storage that syncs with a server that stores data on MySQL, and a client web app that has data stored in IndexedDB. An app user could use the app on their favourite platforms with the same data present everywhere.

The data itself has to be in a standard common format so that it can be synced between any two devices and interpreted on both sides. For this the JSON format is used. Since the developer of the app is the one responsible for picking the data to synchronize, this means it is possible to sync just the data needed and nothing more, and to sanitise the data in such a way to make it platform-agnostic so it works across platforms.

Canonical has released a technical preview of this API so developers can begin experimenting with it. The technical preview includes a reference implementation of U1DB APis in Python using SQLite as storage. The reference implementation includes both server and clients parts, so it is possible to create an app and sync it with a local server. In fact U1DB-enabled apps can sync P2P if they include the server component, so a cloud storage isn’t even required.

Canonical will of course support syncing to Ubuntu One using U1DB, and even make it possible to access the data stored on Ubuntu One via an HTTP API without needing to sync. So if your application is syncing photos as files and image metadata via U1DB, a web interface can simply query the metadata for your photos online and display it.

If you are interested in U1DB you can download the source code for the project from its page on Launchpad. You can read more about how the API works, and how to use it from the documentation site.

Also read:

Kshitij Sobti
Digit.in
Logo
Digit.in
Logo