Rename storage classes (#12913)

This commit is contained in:
Erik Johnston 2022-05-31 13:17:50 +01:00 committed by GitHub
parent e541bb9eed
commit 1e453053cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 708 additions and 551 deletions

View file

@ -65,7 +65,7 @@ class HttpPusher(Pusher):
def __init__(self, hs: "HomeServer", pusher_config: PusherConfig):
super().__init__(hs, pusher_config)
self.storage = self.hs.get_storage()
self._storage_controllers = self.hs.get_storage_controllers()
self.app_display_name = pusher_config.app_display_name
self.device_display_name = pusher_config.device_display_name
self.pushkey_ts = pusher_config.ts
@ -343,7 +343,9 @@ class HttpPusher(Pusher):
}
return d
ctx = await push_tools.get_context_for_event(self.storage, event, self.user_id)
ctx = await push_tools.get_context_for_event(
self._storage_controllers, event, self.user_id
)
d = {
"notification": {

View file

@ -114,10 +114,10 @@ class Mailer:
self.send_email_handler = hs.get_send_email_handler()
self.store = self.hs.get_datastores().main
self.state_storage = self.hs.get_storage().state
self._state_storage_controller = self.hs.get_storage_controllers().state
self.macaroon_gen = self.hs.get_macaroon_generator()
self.state_handler = self.hs.get_state_handler()
self.storage = hs.get_storage()
self._storage_controllers = hs.get_storage_controllers()
self.app_name = app_name
self.email_subjects: EmailSubjectConfig = hs.config.email.email_subjects
@ -456,7 +456,7 @@ class Mailer:
}
the_events = await filter_events_for_client(
self.storage, user_id, results.events_before
self._storage_controllers, user_id, results.events_before
)
the_events.append(notif_event)
@ -494,7 +494,7 @@ class Mailer:
)
else:
# Attempt to check the historical state for the room.
historical_state = await self.state_storage.get_state_for_event(
historical_state = await self._state_storage_controller.get_state_for_event(
event.event_id, StateFilter.from_types((type_state_key,))
)
sender_state_event = historical_state.get(type_state_key)
@ -767,8 +767,10 @@ class Mailer:
member_event_ids.append(sender_state_event_id)
else:
# Attempt to check the historical state for the room.
historical_state = await self.state_storage.get_state_for_event(
event_id, StateFilter.from_types((type_state_key,))
historical_state = (
await self._state_storage_controller.get_state_for_event(
event_id, StateFilter.from_types((type_state_key,))
)
)
sender_state_event = historical_state.get(type_state_key)
if sender_state_event:

View file

@ -16,7 +16,7 @@ from typing import Dict
from synapse.api.constants import ReceiptTypes
from synapse.events import EventBase
from synapse.push.presentable_names import calculate_room_name, name_from_member_event
from synapse.storage import Storage
from synapse.storage.controllers import StorageControllers
from synapse.storage.databases.main import DataStore
@ -52,7 +52,7 @@ async def get_badge_count(store: DataStore, user_id: str, group_by_room: bool) -
async def get_context_for_event(
storage: Storage, ev: EventBase, user_id: str
storage: StorageControllers, ev: EventBase, user_id: str
) -> Dict[str, str]:
ctx = {}