Mercurial > libervia-pubsub
diff idavoll/pgsql_backend.py @ 85:ec557449d1aa
Implement node retraction, with storage support for pgsql.
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Tue, 09 Nov 2004 16:48:20 +0000 |
parents | ec354aab3949 |
children | 59378610b16e |
line wrap: on
line diff
--- a/idavoll/pgsql_backend.py Tue Nov 09 15:58:06 2004 +0000 +++ b/idavoll/pgsql_backend.py Tue Nov 09 16:48:20 2004 +0000 @@ -289,6 +289,24 @@ result = cursor.fetchall() return [r[0] for r in result] + def remove_items(self, node_id, item_ids): + return self.dbpool.runInteraction(self._remove_items, node_id, item_ids) + + def _remove_items(self, cursor, node_id, item_ids): + deleted = [] + + for item_id in item_ids: + cursor.execute("""DELETE FROM items WHERE + node_id=(SELECT id FROM nodes WHERE node=%s) AND + item=%s""", + (node_id.encode('utf-8'), + item_id.encode('utf-8'))) + + if cursor.rowcount: + deleted.append(item_id) + + return deleted + class BackendService(backend.BackendService): """ PostgreSQL backend Service for a JEP-0060 pubsub service """ @@ -309,3 +327,6 @@ class ItemRetrievalService(backend.ItemRetrievalService): pass + +class RetractionService(backend.RetractionService): + pass