summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Cloke <patrickc@matrix.org>2023-04-14 12:15:38 -0400
committerPatrick Cloke <patrickc@matrix.org>2023-05-17 14:26:01 -0400
commitb3e0354c980e4092e022884e8ec0a7a150440569 (patch)
tree014ec85ffa2f496d7b9bf8137132019dfc600771
parentClean-up more references to relations store. (diff)
downloadsynapse-b3e0354c980e4092e022884e8ec0a7a150440569.tar.xz
Be explicit about datastores.
-rw-r--r--synapse/storage/databases/main/__init__.py21
1 files changed, 2 insertions, 19 deletions
diff --git a/synapse/storage/databases/main/__init__.py b/synapse/storage/databases/main/__init__.py
index 867fd84179..2814368027 100644
--- a/synapse/storage/databases/main/__init__.py
+++ b/synapse/storage/databases/main/__init__.py
@@ -130,13 +130,6 @@ class DataStore(
     LockStore,
     SessionStore,
 ):
-    DATASTORE_CLASSES: List[Type[SQLBaseStore]] = [
-        RelationsStore,
-    ]
-
-    # XXX So mypy knows about dynamic properties.
-    relations: RelationsStore
-
     def __init__(
         self,
         database: DatabasePool,
@@ -149,18 +142,8 @@ class DataStore(
 
         super().__init__(database, db_conn, hs)
 
-        def repl(match: Match[str]) -> str:
-            return "_" + match.group(0).lower()
-
-        for datastore_class in self.DATASTORE_CLASSES:
-            name = datastore_class.__name__
-            if name.endswith("Store"):
-                name = name[: -len("Store")]
-
-            name = re.sub(r"[A-Z]", repl, name)[1:]
-
-            store = datastore_class(database, db_conn, hs, self)
-            setattr(self, name, store)
+        # This is a bit repetitive, but avoids dynamically setting attributes.
+        self.relations: RelationsStore = RelationsStore(database, db_conn, hs, self)
 
     async def get_users(self) -> List[JsonDict]:
         """Function to retrieve a list of users in users table.