diff sat_pubsub/pgsql_storage.py @ 406:a58610ab2983

removed old code: - removed gateway which was an HTTP gateway inherited from Idavoll and which is not used is SàT Pubsub - removed memory_storage which has not been maintained since Idavoll and which is expected to be replaced by a sqlite-based backend - simplejson dependency is not used anymore
author Goffi <goffi@goffi.org>
date Fri, 16 Aug 2019 12:00:03 +0200
parents c56a728412f1
children ccb2a22ea0fc
line wrap: on
line diff
--- a/sat_pubsub/pgsql_storage.py	Fri Aug 16 12:00:02 2019 +0200
+++ b/sat_pubsub/pgsql_storage.py	Fri Aug 16 12:00:03 2019 +0200
@@ -1300,80 +1300,3 @@
 class CollectionNode(Node):
 
     nodeType = 'collection'
-
-
-
-class GatewayStorage(object):
-    """
-    Memory based storage facility for the XMPP-HTTP gateway.
-    """
-
-    def __init__(self, dbpool):
-        self.dbpool = dbpool
-
-    def _countCallbacks(self, cursor, service, nodeIdentifier):
-        """
-        Count number of callbacks registered for a node.
-        """
-        cursor.execute("""SELECT count(*) FROM callbacks
-                          WHERE service=%s and node=%s""",
-                       (service.full(),
-                        nodeIdentifier))
-        results = cursor.fetchall()
-        return results[0][0]
-
-    def addCallback(self, service, nodeIdentifier, callback):
-        def interaction(cursor):
-            cursor.execute("""SELECT 1 as bool FROM callbacks
-                              WHERE service=%s and node=%s and uri=%s""",
-                           (service.full(),
-                           nodeIdentifier,
-                           callback))
-            if cursor.fetchall():
-                return
-
-            cursor.execute("""INSERT INTO callbacks
-                              (service, node, uri) VALUES
-                              (%s, %s, %s)""",
-                           (service.full(),
-                           nodeIdentifier,
-                           callback))
-
-        return self.dbpool.runInteraction(interaction)
-
-    def removeCallback(self, service, nodeIdentifier, callback):
-        def interaction(cursor):
-            cursor.execute("""DELETE FROM callbacks
-                              WHERE service=%s and node=%s and uri=%s""",
-                           (service.full(),
-                            nodeIdentifier,
-                            callback))
-
-            if cursor.rowcount != 1:
-                raise error.NotSubscribed()
-
-            last = not self._countCallbacks(cursor, service, nodeIdentifier)
-            return last
-
-        return self.dbpool.runInteraction(interaction)
-
-    def getCallbacks(self, service, nodeIdentifier):
-        def interaction(cursor):
-            cursor.execute("""SELECT uri FROM callbacks
-                              WHERE service=%s and node=%s""",
-                           (service.full(),
-                            nodeIdentifier))
-            results = cursor.fetchall()
-
-            if not results:
-                raise error.NoCallbacks()
-
-            return [result[0] for result in results]
-
-        return self.dbpool.runInteraction(interaction)
-
-    def hasCallbacks(self, service, nodeIdentifier):
-        def interaction(cursor):
-            return bool(self._countCallbacks(cursor, service, nodeIdentifier))
-
-        return self.dbpool.runInteraction(interaction)