summary refs log tree commit diff
path: root/synapse/storage/directory.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/storage/directory.py')
-rw-r--r--synapse/storage/directory.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/synapse/storage/directory.py b/synapse/storage/directory.py
index 68b7d59693..e13b336934 100644
--- a/synapse/storage/directory.py
+++ b/synapse/storage/directory.py
@@ -134,6 +134,29 @@ class DirectoryStore(SQLBaseStore):
 
         return room_id
 
+    @defer.inlineCallbacks
+    def get_all_associations(self):
+        """Retrieve the entire list of room alias -> room ID pairings.
+
+        Returns:
+            A list of RoomAliasMappings.
+        """
+        results = self._simple_select_list(
+            "room_aliases",
+            None,
+            ["room_alias", "room_id"]
+        )
+        # TODO(kegan): It feels wrong to be specifying no servers here, but
+        # equally this function isn't required to obtain all servers so
+        # retrieving them "just for the sake of it" also seems wrong, but we
+        # want to conform to passing Objects around and not dicts..
+        return [
+            RoomAliasMapping(
+                room_id=r["room_id"], room_alias=r["room_alias"], servers=""
+            ) for r in results
+        ]
+
+
     def get_aliases_for_room(self, room_id):
         return self._simple_select_onecol(
             "room_aliases",