← Back to team overview

u1db-discuss team mailing list archive

A DB of my own

 

One of the things that isn't clear at the moment is whether u1db should
do extra work to enable shared databases. By shared, I mean a u1db
database being accessed by more than one application at once.

To be clear, this question is not about the backend being able to handle
being opened by multiple applications. This is about app developers.
(And only app developers on platforms where a file *can* be shared;
Windows, Ubuntu, OS X, possibly Android; not the server-side web, iOS,
in-browser.)

The obvious problem for app devs if another application might
simultaneously edit their database is that the data will change and they
won't know. So, if we encourage the idea of multiple apps using the same
database, we'll need to come up with a way that apps can know that the
data has changed. At the moment we have whats_changed(generation), but
apps don't know when to call that... so they'll have to poll, which is
bad.

Actual apps using a database simultaneously is likely to be fairly rare,
but one thing that has been talked about is a "sync daemon"; on desktop
environments, if you save a u1db in a particular location then the sync
daemon would sync that u1db with Ubuntu One for you. This process has
two big advantages: the first is that apps don't have to handle the sync
process themselves, and the second is that apps don't need to handle
authentication to Ubuntu One themselves. This sync daemon would
obviously be an app accessing the databases; if it existed, apps would
have to have some way to know that the data had changed.

It is difficult to think of a good way of handling this without either
apps polling whats_changed in a background thread or implementations
providing some sort of async the-database-has-changed signal. However,
async stuff is very implementation-specific, which makes it hard to
document this approach, and the Python reference implementation won't
contain it (because it is all sync and does not require a mainloop).

So... do we have a sync daemon and support multiple apps? Or do we avoid
this problem by not dealing with it, at the expense of making every app
developer handle authentication and syncing themselves?

sil




Follow ups