summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2021-11-15 13:58:26 +0000
committerDavid Robertson <davidr@element.io>2021-11-16 11:49:11 +0000
commit9a316ecd3cee5225bf7b8510a531da1567b23e3f (patch)
treed95e1ae7a045495cc4b42d9bb30dc4c95cc65f70
parentEasier function annotations (diff)
downloadsynapse-9a316ecd3cee5225bf7b8510a531da1567b23e3f.tar.xz
SCARY: Pull in EventFederationWorkerStore
for e.g. get_latest_event_ids_in_room

Needed on CacheInvalidationWorkerStore for many functions, e.g.
`have_seen_event`.

Fixup MRO in CensorEventsStore.

The BaseSlavedStore is trickier. The removals should be safe because the
removed classes are in parents, via SlavedEventStore -> BaseSlavedStore
-> CacheInvalidationWorkerStore
-rw-r--r--synapse/replication/slave/storage/events.py3
-rw-r--r--synapse/storage/databases/main/cache.py4
-rw-r--r--synapse/storage/databases/main/censor_events.py2
-rw-r--r--synapse/storage/databases/main/events_forward_extremities.py6
4 files changed, 4 insertions, 11 deletions
diff --git a/synapse/replication/slave/storage/events.py b/synapse/replication/slave/storage/events.py
index 63ed50caa5..6080d9fb29 100644
--- a/synapse/replication/slave/storage/events.py
+++ b/synapse/replication/slave/storage/events.py
@@ -47,13 +47,10 @@ logger = logging.getLogger(__name__)
 
 
 class SlavedEventStore(
-    EventFederationWorkerStore,
     RoomMemberWorkerStore,
     EventPushActionsWorkerStore,
     StreamWorkerStore,
     StateGroupWorkerStore,
-    EventsWorkerStore,
-    SignatureWorkerStore,
     UserErasureWorkerStore,
     RelationsWorkerStore,
     BaseSlavedStore,
diff --git a/synapse/storage/databases/main/cache.py b/synapse/storage/databases/main/cache.py
index 32d2fa1b39..fff0824b6a 100644
--- a/synapse/storage/databases/main/cache.py
+++ b/synapse/storage/databases/main/cache.py
@@ -24,12 +24,12 @@ from synapse.replication.tcp.streams.events import (
     EventsStreamCurrentStateRow,
     EventsStreamEventRow,
 )
-from synapse.storage._base import SQLBaseStore
 from synapse.storage.database import (
     DatabasePool,
     LoggingDatabaseConnection,
     LoggingTransaction,
 )
+from synapse.storage.databases.main.event_federation import EventFederationWorkerStore
 from synapse.storage.engines import PostgresEngine
 from synapse.util.caches.descriptors import _CachedFunction
 from synapse.util.iterutils import batch_iter
@@ -48,7 +48,7 @@ CURRENT_STATE_CACHE_NAME = "cs_cache_fake"
 _CacheData = Tuple[str, Optional[List[str]], Optional[int]]
 
 
-class CacheInvalidationWorkerStore(SQLBaseStore):
+class CacheInvalidationWorkerStore(EventFederationWorkerStore):
     def __init__(
         self,
         database: DatabasePool,
diff --git a/synapse/storage/databases/main/censor_events.py b/synapse/storage/databases/main/censor_events.py
index 0f56e10220..0d600208ac 100644
--- a/synapse/storage/databases/main/censor_events.py
+++ b/synapse/storage/databases/main/censor_events.py
@@ -30,7 +30,7 @@ if TYPE_CHECKING:
 logger = logging.getLogger(__name__)
 
 
-class CensorEventsStore(EventsWorkerStore, CacheInvalidationWorkerStore, SQLBaseStore):
+class CensorEventsStore(CacheInvalidationWorkerStore):
     def __init__(self, database: DatabasePool, db_conn, hs: "HomeServer"):
         super().__init__(database, db_conn, hs)
 
diff --git a/synapse/storage/databases/main/events_forward_extremities.py b/synapse/storage/databases/main/events_forward_extremities.py
index 68901b4335..404cd96278 100644
--- a/synapse/storage/databases/main/events_forward_extremities.py
+++ b/synapse/storage/databases/main/events_forward_extremities.py
@@ -18,15 +18,11 @@ from typing import Any, Dict, List
 from synapse.api.errors import SynapseError
 from synapse.storage.database import LoggingTransaction
 from synapse.storage.databases.main import CacheInvalidationWorkerStore
-from synapse.storage.databases.main.event_federation import EventFederationWorkerStore
 
 logger = logging.getLogger(__name__)
 
 
-class EventForwardExtremitiesStore(
-    EventFederationWorkerStore,
-    CacheInvalidationWorkerStore,
-):
+class EventForwardExtremitiesStore(CacheInvalidationWorkerStore):
     async def delete_forward_extremities_for_room(self, room_id: str) -> int:
         """Delete any extra forward extremities for a room.