diff idavoll/tap_http.py @ 204:b4bf0a5ce50d

Implement storage facilities for the HTTP gateway. Author: ralphm. Fixes #12. One of the storage facilities is PostgreSQL based, providing persistence.
author Ralph Meijer <ralphm@ik.nu>
date Wed, 16 Jul 2008 06:38:32 +0000
parents 9038908dc2f5
children 274a45d2a5ab
line wrap: on
line diff
--- a/idavoll/tap_http.py	Mon Jul 14 09:16:16 2008 +0000
+++ b/idavoll/tap_http.py	Wed Jul 16 06:38:32 2008 +0000
@@ -36,7 +36,14 @@
 
     # Set up XMPP service for subscribing to remote nodes
 
-    ss = RemoteSubscriptionService(config['jid'])
+    if config['backend'] == 'pgsql':
+        from idavoll.pgsql_storage import GatewayStorage
+        gst = GatewayStorage(bs.storage.dbpool)
+    elif config['backend'] == 'memory':
+        from idavoll.memory_storage import GatewayStorage
+        gst = GatewayStorage()
+
+    ss = RemoteSubscriptionService(config['jid'], gst)
     ss.setHandlerParent(cs)
     ss.startService()