Cloud Database

I’m trying to design a library to help building cloud mobile apps.

The phrase “Cloud Database” can have two (or more) meanings:

  1. A database system that scales when needed (like what amazon provides) which is provided as a service and is called DBaaS.
  2. A database that can be accessed in multiple places (even when they are offline) and syncs automatically.

For the second one, I couldn’t find a working product. There are a lot of tutorials available about how to build an app that syncs itself with the server, but these tutorials are providing a framework. I want a black-box library that you include in your project and use it as a mediator to connect to your database. So you will not be bothered with syncing in the cloud stuff. You build your app just like a normal app and the magic happens automatically by the library.

Now, since android native apps built using java has the most common market (I assume!) and I already know how to build android apps and own many android devices, I’m going to build a library for android first.

Android uses SQLite as database engine and it provides proper classes to use SQLite in your project. The package is available in “android.database.sqlite”. I wanted to extend the “SQLiteDatabase” to change it according to my needs, but this class is final. So I decided to build a wrapper around it.

I built a wrapper that logs every sql query it gets and has a “sync” method which will send all new logs to the server and if the server gives a success message, it will mark them as synced.

Now, I have to create a sync framework and decide how to keep data in sync.