The idea of putting CouchDB on every desktop has been getting a lot of play at GCDS this week, which is cool. Some of the stuff we’ve been working on is to do with the infrastructure of that, and we* found time to separate this out into a separate project, desktopcouch on Launchpad. There’s a few things in there already:
- Startup scripts for a “personal” desktop Couch
- A D-Bus “port advertiser”: because the scripts start up your desktop Couch on a random port, you need to find out which port that is, and so there’s a tiny D-Bus API which returns the port number
- The D-Bus API is designed to be run from D-Bus activation; if your desktop Couch isn’t running then it is started by the D-Bus API. This means that your desktop Couch isn’t running on startup, so startup time isn’t affected, but the first time anything tries to use it it is started.
- Pairing between two of your desktop Couches. This isn’t finished yet, but this is for sharing your data between two of your machines. Say you’ve got a laptop and a netbook; you pair those two machines and then any data in one appears in the other. So, if you’re storing your Firefox bookmarks in your desktop Couch then adding a new bookmark on your netbook will cause it to appear on your desktop. All this pairing works on your local network; it doesn’t use a server out there on the internet. (Nice work, Chad!)
- The Records API. As noted earlier in these pages we’re all
talking about having a few extra fields in each document in a
desktop Couch to add some extra useful infrastructure. CouchDB
documents with these fields in we’re calling “records”.
record_type_versionare to help you know what type of thing a record describes. The standard way of storing a list as a uuid-keyed dictionary helps when replicating data around between paired desktop Couches. This “Records API” is a Python API for accessing your desktop Couch; it handles the record_type stuff and the MergeableList stuff for you, and it also takes care of things like doing the D-Bus call to find out your desktop Couch’s port number. (Note that it’ll “fall back” to a system-level CouchDB on port 5984, so if you want to experiment you don’t need a desktop Couch up and running!)