ralphm.net

ralphm's blog

Monday, 18 October 2004

Idavoll 2: PostgreSQL backend

Remembering stuff...

The rewrite of Idavoll, dubbed Idavoll 2, is starting to shape up. Besides the volatile memory backend, I started working on a second backend, using PostgreSQL for storage. It uses Twisted Enterprise, that provides asynchronous access to any DB-API 2.0 compliant database interface, in this case pyPgSQL.

I'm still learning how to code in the Twisted Way™, and having two separate backends helps figure out how to use Services, Interfaces and Adaptors in a productive way. Having thought about Idavoll's architecture a bit more, it would probably be a good idea to spread the pubsub features over several backend interfaces, with matching adaptors. That way, one can create custom backends that implement a limited set of functionality, or have a service that offers some functionality using other protocols. Examples:

  • A service with a web interface to manage the nodes, affiliations, and subscriptions.

  • A HTTP interface for publishing data, using REST or SOAP. Like Atom API.

  • Using SMTP for notifications.

I plan to redo the backend for Mimír this way. While being able to setup your channel subscriptions via the Jabber pubsub protocol, the web interface could be reimplemented as an Adaptor between the backend interface and Twisted Web or Nevow.

But that is the future. Back to creating the building blocks.