Remove HomeServer.get_datastore() (#12031)

The presence of this method was confusing, and mostly present for backwards
compatibility. Let's get rid of it.

Part of #11733
This commit is contained in:
Richard van der Hoff 2022-02-23 11:04:02 +00:00 committed by GitHub
parent c1ac2a8135
commit e24ff8ebe3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
230 changed files with 526 additions and 500 deletions

1
changelog.d/12031.misc Normal file
View File

@ -0,0 +1 @@
Remove legacy `HomeServer.get_datastore()`.

View File

@ -94,6 +94,6 @@ As a simple example, retrieving an event from the database:
```pycon ```pycon
>>> from twisted.internet import defer >>> from twisted.internet import defer
>>> defer.ensureDeferred(hs.get_datastore().get_event('$1416420717069yeQaw:matrix.org')) >>> defer.ensureDeferred(hs.get_datastores().main.get_event('$1416420717069yeQaw:matrix.org'))
<Deferred at 0x7ff253fc6998 current result: <FrozenEvent event_id='$1416420717069yeQaw:matrix.org', type='m.room.create', state_key=''>> <Deferred at 0x7ff253fc6998 current result: <FrozenEvent event_id='$1416420717069yeQaw:matrix.org', type='m.room.create', state_key=''>>
``` ```

View File

@ -44,7 +44,7 @@ class MockHomeserver(HomeServer):
def run_background_updates(hs): def run_background_updates(hs):
store = hs.get_datastore() store = hs.get_datastores().main
async def run_background_updates(): async def run_background_updates():
await store.db_pool.updates.run_background_updates(sleep=False) await store.db_pool.updates.run_background_updates(sleep=False)

View File

@ -60,7 +60,7 @@ class Auth:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.hs = hs self.hs = hs
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.state = hs.get_state_handler() self.state = hs.get_state_handler()
self._account_validity_handler = hs.get_account_validity_handler() self._account_validity_handler = hs.get_account_validity_handler()

View File

@ -28,7 +28,7 @@ logger = logging.getLogger(__name__)
class AuthBlocking: class AuthBlocking:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self._server_notices_mxid = hs.config.servernotices.server_notices_mxid self._server_notices_mxid = hs.config.servernotices.server_notices_mxid
self._hs_disabled = hs.config.server.hs_disabled self._hs_disabled = hs.config.server.hs_disabled

View File

@ -150,7 +150,7 @@ def matrix_user_id_validator(user_id_str: str) -> UserID:
class Filtering: class Filtering:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._hs = hs self._hs = hs
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.DEFAULT_FILTER_COLLECTION = FilterCollection(hs, {}) self.DEFAULT_FILTER_COLLECTION = FilterCollection(hs, {})
@ -294,7 +294,7 @@ class FilterCollection:
class Filter: class Filter:
def __init__(self, hs: "HomeServer", filter_json: JsonDict): def __init__(self, hs: "HomeServer", filter_json: JsonDict):
self._hs = hs self._hs = hs
self._store = hs.get_datastore() self._store = hs.get_datastores().main
self.filter_json = filter_json self.filter_json = filter_json
self.limit = filter_json.get("limit", 10) self.limit = filter_json.get("limit", 10)

View File

@ -448,7 +448,7 @@ async def start(hs: "HomeServer") -> None:
# It is now safe to start your Synapse. # It is now safe to start your Synapse.
hs.start_listening() hs.start_listening()
hs.get_datastore().db_pool.start_profiling() hs.get_datastores().main.db_pool.start_profiling()
hs.get_pusherpool().start() hs.get_pusherpool().start()
# Log when we start the shut down process. # Log when we start the shut down process.

View File

@ -142,7 +142,7 @@ class KeyUploadServlet(RestServlet):
""" """
super().__init__() super().__init__()
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.http_client = hs.get_simple_http_client() self.http_client = hs.get_simple_http_client()
self.main_uri = hs.config.worker.worker_main_http_uri self.main_uri = hs.config.worker.worker_main_http_uri

View File

@ -372,7 +372,7 @@ def setup(config_options: List[str]) -> SynapseHomeServer:
await _base.start(hs) await _base.start(hs)
hs.get_datastore().db_pool.updates.start_doing_background_updates() hs.get_datastores().main.db_pool.updates.start_doing_background_updates()
register_start(start) register_start(start)

View File

@ -82,7 +82,7 @@ async def phone_stats_home(
# General statistics # General statistics
# #
store = hs.get_datastore() store = hs.get_datastores().main
stats["homeserver"] = hs.config.server.server_name stats["homeserver"] = hs.config.server.server_name
stats["server_context"] = hs.config.server.server_context stats["server_context"] = hs.config.server.server_context
@ -170,18 +170,22 @@ def start_phone_stats_home(hs: "HomeServer") -> None:
# Rather than update on per session basis, batch up the requests. # Rather than update on per session basis, batch up the requests.
# If you increase the loop period, the accuracy of user_daily_visits # If you increase the loop period, the accuracy of user_daily_visits
# table will decrease # table will decrease
clock.looping_call(hs.get_datastore().generate_user_daily_visits, 5 * 60 * 1000) clock.looping_call(
hs.get_datastores().main.generate_user_daily_visits, 5 * 60 * 1000
)
# monthly active user limiting functionality # monthly active user limiting functionality
clock.looping_call(hs.get_datastore().reap_monthly_active_users, 1000 * 60 * 60) clock.looping_call(
hs.get_datastore().reap_monthly_active_users() hs.get_datastores().main.reap_monthly_active_users, 1000 * 60 * 60
)
hs.get_datastores().main.reap_monthly_active_users()
@wrap_as_background_process("generate_monthly_active_users") @wrap_as_background_process("generate_monthly_active_users")
async def generate_monthly_active_users() -> None: async def generate_monthly_active_users() -> None:
current_mau_count = 0 current_mau_count = 0
current_mau_count_by_service = {} current_mau_count_by_service = {}
reserved_users: Sized = () reserved_users: Sized = ()
store = hs.get_datastore() store = hs.get_datastores().main
if hs.config.server.limit_usage_by_mau or hs.config.server.mau_stats_only: if hs.config.server.limit_usage_by_mau or hs.config.server.mau_stats_only:
current_mau_count = await store.get_monthly_active_count() current_mau_count = await store.get_monthly_active_count()
current_mau_count_by_service = ( current_mau_count_by_service = (

View File

@ -92,7 +92,7 @@ class ApplicationServiceScheduler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.as_api = hs.get_application_service_api() self.as_api = hs.get_application_service_api()
self.txn_ctrl = _TransactionController(self.clock, self.store, self.as_api) self.txn_ctrl = _TransactionController(self.clock, self.store, self.as_api)

View File

@ -476,7 +476,7 @@ class StoreKeyFetcher(KeyFetcher):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__(hs) super().__init__(hs)
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def _fetch_keys( async def _fetch_keys(
self, keys_to_fetch: List[_FetchKeyRequest] self, keys_to_fetch: List[_FetchKeyRequest]
@ -498,7 +498,7 @@ class BaseV2KeyFetcher(KeyFetcher):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__(hs) super().__init__(hs)
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.config = hs.config self.config = hs.config
async def process_v2_response( async def process_v2_response(

View File

@ -189,7 +189,7 @@ class EventBuilderFactory:
self.hostname = hs.hostname self.hostname = hs.hostname
self.signing_key = hs.signing_key self.signing_key = hs.signing_key
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.state = hs.get_state_handler() self.state = hs.get_state_handler()
self._event_auth_handler = hs.get_event_auth_handler() self._event_auth_handler = hs.get_event_auth_handler()

View File

@ -143,7 +143,7 @@ class ThirdPartyEventRules:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.third_party_rules = None self.third_party_rules = None
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self._check_event_allowed_callbacks: List[CHECK_EVENT_ALLOWED_CALLBACK] = [] self._check_event_allowed_callbacks: List[CHECK_EVENT_ALLOWED_CALLBACK] = []
self._on_create_room_callbacks: List[ON_CREATE_ROOM_CALLBACK] = [] self._on_create_room_callbacks: List[ON_CREATE_ROOM_CALLBACK] = []

View File

@ -39,7 +39,7 @@ class FederationBase:
self.server_name = hs.hostname self.server_name = hs.hostname
self.keyring = hs.get_keyring() self.keyring = hs.get_keyring()
self.spam_checker = hs.get_spam_checker() self.spam_checker = hs.get_spam_checker()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self._clock = hs.get_clock() self._clock = hs.get_clock()
async def _check_sigs_and_hash( async def _check_sigs_and_hash(

View File

@ -228,7 +228,7 @@ class FederationSender(AbstractFederationSender):
self.hs = hs self.hs = hs
self.server_name = hs.hostname self.server_name = hs.hostname
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.state = hs.get_state_handler() self.state = hs.get_state_handler()
self.clock = hs.get_clock() self.clock = hs.get_clock()

View File

@ -76,7 +76,7 @@ class PerDestinationQueue:
): ):
self._server_name = hs.hostname self._server_name = hs.hostname
self._clock = hs.get_clock() self._clock = hs.get_clock()
self._store = hs.get_datastore() self._store = hs.get_datastores().main
self._transaction_manager = transaction_manager self._transaction_manager = transaction_manager
self._instance_name = hs.get_instance_name() self._instance_name = hs.get_instance_name()
self._federation_shard_config = hs.config.worker.federation_shard_config self._federation_shard_config = hs.config.worker.federation_shard_config
@ -381,9 +381,8 @@ class PerDestinationQueue:
) )
) )
last_successful_stream_ordering = self._last_successful_stream_ordering _tmp_last_successful_stream_ordering = self._last_successful_stream_ordering
if _tmp_last_successful_stream_ordering is None:
if last_successful_stream_ordering is None:
# if it's still None, then this means we don't have the information # if it's still None, then this means we don't have the information
# in our database ­ we haven't successfully sent a PDU to this server # in our database ­ we haven't successfully sent a PDU to this server
# (at least since the introduction of the feature tracking # (at least since the introduction of the feature tracking
@ -393,6 +392,8 @@ class PerDestinationQueue:
self._catching_up = False self._catching_up = False
return return
last_successful_stream_ordering: int = _tmp_last_successful_stream_ordering
# get at most 50 catchup room/PDUs # get at most 50 catchup room/PDUs
while True: while True:
event_ids = await self._store.get_catch_up_room_event_ids( event_ids = await self._store.get_catch_up_room_event_ids(

View File

@ -53,7 +53,7 @@ class TransactionManager:
def __init__(self, hs: "synapse.server.HomeServer"): def __init__(self, hs: "synapse.server.HomeServer"):
self._server_name = hs.hostname self._server_name = hs.hostname
self.clock = hs.get_clock() # nb must be called this for @measure_func self.clock = hs.get_clock() # nb must be called this for @measure_func
self._store = hs.get_datastore() self._store = hs.get_datastores().main
self._transaction_actions = TransactionActions(self._store) self._transaction_actions = TransactionActions(self._store)
self._transport_layer = hs.get_federation_transport_client() self._transport_layer = hs.get_federation_transport_client()

View File

@ -55,7 +55,7 @@ class Authenticator:
self._clock = hs.get_clock() self._clock = hs.get_clock()
self.keyring = hs.get_keyring() self.keyring = hs.get_keyring()
self.server_name = hs.hostname self.server_name = hs.hostname
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.federation_domain_whitelist = ( self.federation_domain_whitelist = (
hs.config.federation.federation_domain_whitelist hs.config.federation.federation_domain_whitelist
) )

View File

@ -746,7 +746,7 @@ class RoomComplexityServlet(BaseFederationServlet):
server_name: str, server_name: str,
): ):
super().__init__(hs, authenticator, ratelimiter, server_name) super().__init__(hs, authenticator, ratelimiter, server_name)
self._store = self.hs.get_datastore() self._store = self.hs.get_datastores().main
async def on_GET( async def on_GET(
self, self,

View File

@ -140,7 +140,7 @@ class GroupAttestionRenewer:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.assestations = hs.get_groups_attestation_signing() self.assestations = hs.get_groups_attestation_signing()
self.transport_client = hs.get_federation_transport_client() self.transport_client = hs.get_federation_transport_client()
self.is_mine_id = hs.is_mine_id self.is_mine_id = hs.is_mine_id

View File

@ -45,7 +45,7 @@ MAX_LONG_DESC_LEN = 10000
class GroupsServerWorkerHandler: class GroupsServerWorkerHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.hs = hs self.hs = hs
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.room_list_handler = hs.get_room_list_handler() self.room_list_handler = hs.get_room_list_handler()
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.clock = hs.get_clock() self.clock = hs.get_clock()

View File

@ -30,7 +30,7 @@ if TYPE_CHECKING:
class AccountDataHandler: class AccountDataHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._store = hs.get_datastore() self._store = hs.get_datastores().main
self._instance_name = hs.get_instance_name() self._instance_name = hs.get_instance_name()
self._notifier = hs.get_notifier() self._notifier = hs.get_notifier()
@ -166,7 +166,7 @@ class AccountDataHandler:
class AccountDataEventSource(EventSource[int, JsonDict]): class AccountDataEventSource(EventSource[int, JsonDict]):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
def get_current_key(self, direction: str = "f") -> int: def get_current_key(self, direction: str = "f") -> int:
return self.store.get_max_account_data_stream_id() return self.store.get_max_account_data_stream_id()

View File

@ -43,7 +43,7 @@ class AccountValidityHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.hs = hs self.hs = hs
self.config = hs.config self.config = hs.config
self.store = self.hs.get_datastore() self.store = self.hs.get_datastores().main
self.send_email_handler = self.hs.get_send_email_handler() self.send_email_handler = self.hs.get_send_email_handler()
self.clock = self.hs.get_clock() self.clock = self.hs.get_clock()

View File

@ -29,7 +29,7 @@ logger = logging.getLogger(__name__)
class AdminHandler: class AdminHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.storage = hs.get_storage() self.storage = hs.get_storage()
self.state_store = self.storage.state self.state_store = self.storage.state

View File

@ -47,7 +47,7 @@ events_processed_counter = Counter("synapse_handlers_appservice_events_processed
class ApplicationServicesHandler: class ApplicationServicesHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.is_mine_id = hs.is_mine_id self.is_mine_id = hs.is_mine_id
self.appservice_api = hs.get_application_service_api() self.appservice_api = hs.get_application_service_api()
self.scheduler = hs.get_application_service_scheduler() self.scheduler = hs.get_application_service_scheduler()

View File

@ -194,7 +194,7 @@ class AuthHandler:
SESSION_EXPIRE_MS = 48 * 60 * 60 * 1000 SESSION_EXPIRE_MS = 48 * 60 * 60 * 1000
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.checkers: Dict[str, UserInteractiveAuthChecker] = {} self.checkers: Dict[str, UserInteractiveAuthChecker] = {}
@ -1183,7 +1183,7 @@ class AuthHandler:
# No password providers were able to handle this 3pid # No password providers were able to handle this 3pid
# Check local store # Check local store
user_id = await self.hs.get_datastore().get_user_id_by_threepid( user_id = await self.hs.get_datastores().main.get_user_id_by_threepid(
medium, address medium, address
) )
if not user_id: if not user_id:

View File

@ -61,7 +61,7 @@ class CasHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.hs = hs self.hs = hs
self._hostname = hs.hostname self._hostname = hs.hostname
self._store = hs.get_datastore() self._store = hs.get_datastores().main
self._auth_handler = hs.get_auth_handler() self._auth_handler = hs.get_auth_handler()
self._registration_handler = hs.get_registration_handler() self._registration_handler = hs.get_registration_handler()

View File

@ -29,7 +29,7 @@ class DeactivateAccountHandler:
"""Handler which deals with deactivating user accounts.""" """Handler which deals with deactivating user accounts."""
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.hs = hs self.hs = hs
self._auth_handler = hs.get_auth_handler() self._auth_handler = hs.get_auth_handler()
self._device_handler = hs.get_device_handler() self._device_handler = hs.get_device_handler()

View File

@ -63,7 +63,7 @@ class DeviceWorkerHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.hs = hs self.hs = hs
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.notifier = hs.get_notifier() self.notifier = hs.get_notifier()
self.state = hs.get_state_handler() self.state = hs.get_state_handler()
self.state_store = hs.get_storage().state self.state_store = hs.get_storage().state
@ -628,7 +628,7 @@ class DeviceListUpdater:
"Handles incoming device list updates from federation and updates the DB" "Handles incoming device list updates from federation and updates the DB"
def __init__(self, hs: "HomeServer", device_handler: DeviceHandler): def __init__(self, hs: "HomeServer", device_handler: DeviceHandler):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.federation = hs.get_federation_client() self.federation = hs.get_federation_client()
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.device_handler = device_handler self.device_handler = device_handler

View File

@ -43,7 +43,7 @@ class DeviceMessageHandler:
Args: Args:
hs: server hs: server
""" """
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.notifier = hs.get_notifier() self.notifier = hs.get_notifier()
self.is_mine = hs.is_mine self.is_mine = hs.is_mine

View File

@ -44,7 +44,7 @@ class DirectoryHandler:
self.state = hs.get_state_handler() self.state = hs.get_state_handler()
self.appservice_handler = hs.get_application_service_handler() self.appservice_handler = hs.get_application_service_handler()
self.event_creation_handler = hs.get_event_creation_handler() self.event_creation_handler = hs.get_event_creation_handler()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.config = hs.config self.config = hs.config
self.enable_room_list_search = hs.config.roomdirectory.enable_room_list_search self.enable_room_list_search = hs.config.roomdirectory.enable_room_list_search
self.require_membership = hs.config.server.require_membership_for_aliases self.require_membership = hs.config.server.require_membership_for_aliases

View File

@ -47,7 +47,7 @@ logger = logging.getLogger(__name__)
class E2eKeysHandler: class E2eKeysHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.federation = hs.get_federation_client() self.federation = hs.get_federation_client()
self.device_handler = hs.get_device_handler() self.device_handler = hs.get_device_handler()
self.is_mine = hs.is_mine self.is_mine = hs.is_mine
@ -1335,7 +1335,7 @@ class SigningKeyEduUpdater:
"""Handles incoming signing key updates from federation and updates the DB""" """Handles incoming signing key updates from federation and updates the DB"""
def __init__(self, hs: "HomeServer", e2e_keys_handler: E2eKeysHandler): def __init__(self, hs: "HomeServer", e2e_keys_handler: E2eKeysHandler):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.federation = hs.get_federation_client() self.federation = hs.get_federation_client()
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.e2e_keys_handler = e2e_keys_handler self.e2e_keys_handler = e2e_keys_handler

View File

@ -45,7 +45,7 @@ class E2eRoomKeysHandler:
""" """
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
# Used to lock whenever a client is uploading key data. This prevents collisions # Used to lock whenever a client is uploading key data. This prevents collisions
# between clients trying to upload the details of a new session, given all # between clients trying to upload the details of a new session, given all

View File

@ -43,7 +43,7 @@ class EventAuthHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._clock = hs.get_clock() self._clock = hs.get_clock()
self._store = hs.get_datastore() self._store = hs.get_datastores().main
self._server_name = hs.hostname self._server_name = hs.hostname
async def check_auth_rules_from_context( async def check_auth_rules_from_context(

View File

@ -33,7 +33,7 @@ logger = logging.getLogger(__name__)
class EventStreamHandler: class EventStreamHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.hs = hs self.hs = hs
@ -134,7 +134,7 @@ class EventStreamHandler:
class EventHandler: class EventHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.storage = hs.get_storage() self.storage = hs.get_storage()
async def get_event( async def get_event(

View File

@ -107,7 +107,7 @@ class FederationHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.hs = hs self.hs = hs
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.storage = hs.get_storage() self.storage = hs.get_storage()
self.state_store = self.storage.state self.state_store = self.storage.state
self.federation_client = hs.get_federation_client() self.federation_client = hs.get_federation_client()

View File

@ -95,7 +95,7 @@ class FederationEventHandler:
""" """
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._store = hs.get_datastore() self._store = hs.get_datastores().main
self._storage = hs.get_storage() self._storage = hs.get_storage()
self._state_store = self._storage.state self._state_store = self._storage.state

View File

@ -63,7 +63,7 @@ def _create_rerouter(func_name: str) -> Callable[..., Awaitable[JsonDict]]:
class GroupsLocalWorkerHandler: class GroupsLocalWorkerHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.hs = hs self.hs = hs
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.room_list_handler = hs.get_room_list_handler() self.room_list_handler = hs.get_room_list_handler()
self.groups_server_handler = hs.get_groups_server_handler() self.groups_server_handler = hs.get_groups_server_handler()
self.transport_client = hs.get_federation_transport_client() self.transport_client = hs.get_federation_transport_client()

View File

@ -49,7 +49,7 @@ id_server_scheme = "https://"
class IdentityHandler: class IdentityHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
# An HTTP client for contacting trusted URLs. # An HTTP client for contacting trusted URLs.
self.http_client = SimpleHttpClient(hs) self.http_client = SimpleHttpClient(hs)
# An HTTP client for contacting identity servers specified by clients. # An HTTP client for contacting identity servers specified by clients.

View File

@ -46,7 +46,7 @@ logger = logging.getLogger(__name__)
class InitialSyncHandler: class InitialSyncHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.state_handler = hs.get_state_handler() self.state_handler = hs.get_state_handler()
self.hs = hs self.hs = hs

View File

@ -75,7 +75,7 @@ class MessageHandler:
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.state = hs.get_state_handler() self.state = hs.get_state_handler()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.storage = hs.get_storage() self.storage = hs.get_storage()
self.state_store = self.storage.state self.state_store = self.storage.state
self._event_serializer = hs.get_event_client_serializer() self._event_serializer = hs.get_event_client_serializer()
@ -397,7 +397,7 @@ class EventCreationHandler:
self.hs = hs self.hs = hs
self.auth = hs.get_auth() self.auth = hs.get_auth()
self._event_auth_handler = hs.get_event_auth_handler() self._event_auth_handler = hs.get_event_auth_handler()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.storage = hs.get_storage() self.storage = hs.get_storage()
self.state = hs.get_state_handler() self.state = hs.get_state_handler()
self.clock = hs.get_clock() self.clock = hs.get_clock()

View File

@ -273,7 +273,7 @@ class OidcProvider:
token_generator: "OidcSessionTokenGenerator", token_generator: "OidcSessionTokenGenerator",
provider: OidcProviderConfig, provider: OidcProviderConfig,
): ):
self._store = hs.get_datastore() self._store = hs.get_datastores().main
self._token_generator = token_generator self._token_generator = token_generator

View File

@ -127,7 +127,7 @@ class PaginationHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.hs = hs self.hs = hs
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.storage = hs.get_storage() self.storage = hs.get_storage()
self.state_store = self.storage.state self.state_store = self.storage.state
self.clock = hs.get_clock() self.clock = hs.get_clock()

View File

@ -133,7 +133,7 @@ class BasePresenceHandler(abc.ABC):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.presence_router = hs.get_presence_router() self.presence_router = hs.get_presence_router()
self.state = hs.get_state_handler() self.state = hs.get_state_handler()
self.is_mine_id = hs.is_mine_id self.is_mine_id = hs.is_mine_id
@ -1541,7 +1541,7 @@ class PresenceEventSource(EventSource[int, UserPresenceState]):
self.get_presence_handler = hs.get_presence_handler self.get_presence_handler = hs.get_presence_handler
self.get_presence_router = hs.get_presence_router self.get_presence_router = hs.get_presence_router
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def get_new_events( async def get_new_events(
self, self,

View File

@ -54,7 +54,7 @@ class ProfileHandler:
PROFILE_UPDATE_EVERY_MS = 24 * 60 * 60 * 1000 PROFILE_UPDATE_EVERY_MS = 24 * 60 * 60 * 1000
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.hs = hs self.hs = hs

View File

@ -26,7 +26,7 @@ logger = logging.getLogger(__name__)
class ReadMarkerHandler: class ReadMarkerHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.server_name = hs.config.server.server_name self.server_name = hs.config.server.server_name
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.account_data_handler = hs.get_account_data_handler() self.account_data_handler = hs.get_account_data_handler()
self.read_marker_linearizer = Linearizer(name="read_marker") self.read_marker_linearizer = Linearizer(name="read_marker")

View File

@ -29,7 +29,7 @@ class ReceiptsHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.notifier = hs.get_notifier() self.notifier = hs.get_notifier()
self.server_name = hs.config.server.server_name self.server_name = hs.config.server.server_name
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.event_auth_handler = hs.get_event_auth_handler() self.event_auth_handler = hs.get_event_auth_handler()
self.hs = hs self.hs = hs
@ -163,7 +163,7 @@ class ReceiptsHandler:
class ReceiptEventSource(EventSource[int, JsonDict]): class ReceiptEventSource(EventSource[int, JsonDict]):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.config = hs.config self.config = hs.config
@staticmethod @staticmethod

View File

@ -86,7 +86,7 @@ class LoginDict(TypedDict):
class RegistrationHandler: class RegistrationHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.hs = hs self.hs = hs
self.auth = hs.get_auth() self.auth = hs.get_auth()

View File

@ -105,7 +105,7 @@ class EventContext:
class RoomCreationHandler: class RoomCreationHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.hs = hs self.hs = hs
@ -1115,7 +1115,7 @@ class RoomContextHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.hs = hs self.hs = hs
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.storage = hs.get_storage() self.storage = hs.get_storage()
self.state_store = self.storage.state self.state_store = self.storage.state
@ -1246,7 +1246,7 @@ class RoomContextHandler:
class TimestampLookupHandler: class TimestampLookupHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.server_name = hs.hostname self.server_name = hs.hostname
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.state_handler = hs.get_state_handler() self.state_handler = hs.get_state_handler()
self.federation_client = hs.get_federation_client() self.federation_client = hs.get_federation_client()
@ -1386,7 +1386,7 @@ class TimestampLookupHandler:
class RoomEventSource(EventSource[RoomStreamToken, EventBase]): class RoomEventSource(EventSource[RoomStreamToken, EventBase]):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def get_new_events( async def get_new_events(
self, self,
@ -1476,7 +1476,7 @@ class RoomShutdownHandler:
self._room_creation_handler = hs.get_room_creation_handler() self._room_creation_handler = hs.get_room_creation_handler()
self._replication = hs.get_replication_data_handler() self._replication = hs.get_replication_data_handler()
self.event_creation_handler = hs.get_event_creation_handler() self.event_creation_handler = hs.get_event_creation_handler()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def shutdown_room( async def shutdown_room(
self, self,

View File

@ -16,7 +16,7 @@ logger = logging.getLogger(__name__)
class RoomBatchHandler: class RoomBatchHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.hs = hs self.hs = hs
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.state_store = hs.get_storage().state self.state_store = hs.get_storage().state
self.event_creation_handler = hs.get_event_creation_handler() self.event_creation_handler = hs.get_event_creation_handler()
self.room_member_handler = hs.get_room_member_handler() self.room_member_handler = hs.get_room_member_handler()

View File

@ -49,7 +49,7 @@ EMPTY_THIRD_PARTY_ID = ThirdPartyInstanceID(None, None)
class RoomListHandler: class RoomListHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.hs = hs self.hs = hs
self.enable_room_list_search = hs.config.roomdirectory.enable_room_list_search self.enable_room_list_search = hs.config.roomdirectory.enable_room_list_search
self.response_cache: ResponseCache[ self.response_cache: ResponseCache[

View File

@ -66,7 +66,7 @@ class RoomMemberHandler(metaclass=abc.ABCMeta):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.hs = hs self.hs = hs
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.state_handler = hs.get_state_handler() self.state_handler = hs.get_state_handler()
self.config = hs.config self.config = hs.config

View File

@ -90,7 +90,7 @@ class RoomSummaryHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._event_auth_handler = hs.get_event_auth_handler() self._event_auth_handler = hs.get_event_auth_handler()
self._store = hs.get_datastore() self._store = hs.get_datastores().main
self._event_serializer = hs.get_event_client_serializer() self._event_serializer = hs.get_event_client_serializer()
self._server_name = hs.hostname self._server_name = hs.hostname
self._federation_client = hs.get_federation_client() self._federation_client = hs.get_federation_client()

View File

@ -52,7 +52,7 @@ class Saml2SessionData:
class SamlHandler: class SamlHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.server_name = hs.hostname self.server_name = hs.hostname
self._saml_client = Saml2Client(hs.config.saml2.saml2_sp_config) self._saml_client = Saml2Client(hs.config.saml2.saml2_sp_config)

View File

@ -49,7 +49,7 @@ class _SearchResult:
class SearchHandler: class SearchHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.state_handler = hs.get_state_handler() self.state_handler = hs.get_state_handler()
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.hs = hs self.hs = hs

View File

@ -27,7 +27,7 @@ class SetPasswordHandler:
"""Handler which deals with changing user account passwords""" """Handler which deals with changing user account passwords"""
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self._auth_handler = hs.get_auth_handler() self._auth_handler = hs.get_auth_handler()
self._device_handler = hs.get_device_handler() self._device_handler = hs.get_device_handler()

View File

@ -180,7 +180,7 @@ class SsoHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._clock = hs.get_clock() self._clock = hs.get_clock()
self._store = hs.get_datastore() self._store = hs.get_datastores().main
self._server_name = hs.hostname self._server_name = hs.hostname
self._registration_handler = hs.get_registration_handler() self._registration_handler = hs.get_registration_handler()
self._auth_handler = hs.get_auth_handler() self._auth_handler = hs.get_auth_handler()

View File

@ -30,7 +30,7 @@ class MatchChange(Enum):
class StateDeltasHandler: class StateDeltasHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def _get_key_change( async def _get_key_change(
self, self,

View File

@ -39,7 +39,7 @@ class StatsHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.hs = hs self.hs = hs
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.state = hs.get_state_handler() self.state = hs.get_state_handler()
self.server_name = hs.hostname self.server_name = hs.hostname
self.clock = hs.get_clock() self.clock = hs.get_clock()

View File

@ -266,7 +266,7 @@ class SyncResult:
class SyncHandler: class SyncHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.hs_config = hs.config self.hs_config = hs.config
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.notifier = hs.get_notifier() self.notifier = hs.get_notifier()
self.presence_handler = hs.get_presence_handler() self.presence_handler = hs.get_presence_handler()
self.event_sources = hs.get_event_sources() self.event_sources = hs.get_event_sources()

View File

@ -57,7 +57,7 @@ class FollowerTypingHandler:
""" """
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.server_name = hs.config.server.server_name self.server_name = hs.config.server.server_name
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.is_mine_id = hs.is_mine_id self.is_mine_id = hs.is_mine_id
@ -446,7 +446,7 @@ class TypingWriterHandler(FollowerTypingHandler):
class TypingNotificationEventSource(EventSource[int, JsonDict]): class TypingNotificationEventSource(EventSource[int, JsonDict]):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._main_store = hs.get_datastore() self._main_store = hs.get_datastores().main
self.clock = hs.get_clock() self.clock = hs.get_clock()
# We can't call get_typing_handler here because there's a cycle: # We can't call get_typing_handler here because there's a cycle:
# #

View File

@ -139,7 +139,7 @@ class RecaptchaAuthChecker(UserInteractiveAuthChecker):
class _BaseThreepidAuthChecker: class _BaseThreepidAuthChecker:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.hs = hs self.hs = hs
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def _check_threepid(self, medium: str, authdict: dict) -> dict: async def _check_threepid(self, medium: str, authdict: dict) -> dict:
if "threepid_creds" not in authdict: if "threepid_creds" not in authdict:
@ -255,7 +255,7 @@ class RegistrationTokenAuthChecker(UserInteractiveAuthChecker):
super().__init__(hs) super().__init__(hs)
self.hs = hs self.hs = hs
self._enabled = bool(hs.config.registration.registration_requires_token) self._enabled = bool(hs.config.registration.registration_requires_token)
self.store = hs.get_datastore() self.store = hs.get_datastores().main
def is_enabled(self) -> bool: def is_enabled(self) -> bool:
return self._enabled return self._enabled

View File

@ -55,7 +55,7 @@ class UserDirectoryHandler(StateDeltasHandler):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__(hs) super().__init__(hs)
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.server_name = hs.hostname self.server_name = hs.hostname
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.notifier = hs.get_notifier() self.notifier = hs.get_notifier()

View File

@ -351,7 +351,7 @@ class MatrixFederationHttpClient:
) )
self.clock = hs.get_clock() self.clock = hs.get_clock()
self._store = hs.get_datastore() self._store = hs.get_datastores().main
self.version_string_bytes = hs.version_string.encode("ascii") self.version_string_bytes = hs.version_string.encode("ascii")
self.default_timeout = 60 self.default_timeout = 60

View File

@ -172,7 +172,9 @@ class ModuleApi:
# TODO: Fix this type hint once the types for the data stores have been ironed # TODO: Fix this type hint once the types for the data stores have been ironed
# out. # out.
self._store: Union[DataStore, "GenericWorkerSlavedStore"] = hs.get_datastore() self._store: Union[
DataStore, "GenericWorkerSlavedStore"
] = hs.get_datastores().main
self._auth = hs.get_auth() self._auth = hs.get_auth()
self._auth_handler = auth_handler self._auth_handler = auth_handler
self._server_name = hs.hostname self._server_name = hs.hostname
@ -926,7 +928,7 @@ class ModuleApi:
) )
# Try to retrieve the resulting event. # Try to retrieve the resulting event.
event = await self._hs.get_datastore().get_event(event_id) event = await self._hs.get_datastores().main.get_event(event_id)
# update_membership is supposed to always return after the event has been # update_membership is supposed to always return after the event has been
# successfully persisted. # successfully persisted.
@ -1270,7 +1272,7 @@ class PublicRoomListManager:
""" """
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._store = hs.get_datastore() self._store = hs.get_datastores().main
async def room_is_in_public_room_list(self, room_id: str) -> bool: async def room_is_in_public_room_list(self, room_id: str) -> bool:
"""Checks whether a room is in the public room list. """Checks whether a room is in the public room list.

View File

@ -222,7 +222,7 @@ class Notifier:
self.hs = hs self.hs = hs
self.storage = hs.get_storage() self.storage = hs.get_storage()
self.event_sources = hs.get_event_sources() self.event_sources = hs.get_event_sources()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.pending_new_room_events: List[_PendingRoomEventEntry] = [] self.pending_new_room_events: List[_PendingRoomEventEntry] = []
# Called when there are new things to stream over replication # Called when there are new things to stream over replication

View File

@ -68,7 +68,7 @@ class ThrottleParams:
class Pusher(metaclass=abc.ABCMeta): class Pusher(metaclass=abc.ABCMeta):
def __init__(self, hs: "HomeServer", pusher_config: PusherConfig): def __init__(self, hs: "HomeServer", pusher_config: PusherConfig):
self.hs = hs self.hs = hs
self.store = self.hs.get_datastore() self.store = self.hs.get_datastores().main
self.clock = self.hs.get_clock() self.clock = self.hs.get_clock()
self.pusher_id = pusher_config.id self.pusher_id = pusher_config.id

View File

@ -103,7 +103,7 @@ class BulkPushRuleEvaluator:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.hs = hs self.hs = hs
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self._event_auth_handler = hs.get_event_auth_handler() self._event_auth_handler = hs.get_event_auth_handler()
# Used by `RulesForRoom` to ensure only one thing mutates the cache at a # Used by `RulesForRoom` to ensure only one thing mutates the cache at a
@ -366,7 +366,7 @@ class RulesForRoom:
""" """
self.room_id = room_id self.room_id = room_id
self.is_mine_id = hs.is_mine_id self.is_mine_id = hs.is_mine_id
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.room_push_rule_cache_metrics = room_push_rule_cache_metrics self.room_push_rule_cache_metrics = room_push_rule_cache_metrics
# Used to ensure only one thing mutates the cache at a time. Keyed off # Used to ensure only one thing mutates the cache at a time. Keyed off

View File

@ -66,7 +66,7 @@ class EmailPusher(Pusher):
super().__init__(hs, pusher_config) super().__init__(hs, pusher_config)
self.mailer = mailer self.mailer = mailer
self.store = self.hs.get_datastore() self.store = self.hs.get_datastores().main
self.email = pusher_config.pushkey self.email = pusher_config.pushkey
self.timed_call: Optional[IDelayedCall] = None self.timed_call: Optional[IDelayedCall] = None
self.throttle_params: Dict[str, ThrottleParams] = {} self.throttle_params: Dict[str, ThrottleParams] = {}

View File

@ -133,7 +133,7 @@ class HttpPusher(Pusher):
# XXX as per https://github.com/matrix-org/matrix-doc/issues/2627, this seems # XXX as per https://github.com/matrix-org/matrix-doc/issues/2627, this seems
# to be largely redundant. perhaps we can remove it. # to be largely redundant. perhaps we can remove it.
badge = await push_tools.get_badge_count( badge = await push_tools.get_badge_count(
self.hs.get_datastore(), self.hs.get_datastores().main,
self.user_id, self.user_id,
group_by_room=self._group_unread_count_by_room, group_by_room=self._group_unread_count_by_room,
) )
@ -283,7 +283,7 @@ class HttpPusher(Pusher):
tweaks = push_rule_evaluator.tweaks_for_actions(push_action.actions) tweaks = push_rule_evaluator.tweaks_for_actions(push_action.actions)
badge = await push_tools.get_badge_count( badge = await push_tools.get_badge_count(
self.hs.get_datastore(), self.hs.get_datastores().main,
self.user_id, self.user_id,
group_by_room=self._group_unread_count_by_room, group_by_room=self._group_unread_count_by_room,
) )

View File

@ -112,7 +112,7 @@ class Mailer:
self.template_text = template_text self.template_text = template_text
self.send_email_handler = hs.get_send_email_handler() self.send_email_handler = hs.get_send_email_handler()
self.store = self.hs.get_datastore() self.store = self.hs.get_datastores().main
self.state_store = self.hs.get_storage().state self.state_store = self.hs.get_storage().state
self.macaroon_gen = self.hs.get_macaroon_generator() self.macaroon_gen = self.hs.get_macaroon_generator()
self.state_handler = self.hs.get_state_handler() self.state_handler = self.hs.get_state_handler()

View File

@ -59,7 +59,7 @@ class PusherPool:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.hs = hs self.hs = hs
self.pusher_factory = PusherFactory(hs) self.pusher_factory = PusherFactory(hs)
self.store = self.hs.get_datastore() self.store = self.hs.get_datastores().main
self.clock = self.hs.get_clock() self.clock = self.hs.get_clock()
# We shard the handling of push notifications by user ID. # We shard the handling of push notifications by user ID.

View File

@ -63,7 +63,7 @@ class ReplicationUserDevicesResyncRestServlet(ReplicationEndpoint):
super().__init__(hs) super().__init__(hs)
self.device_list_updater = hs.get_device_handler().device_list_updater self.device_list_updater = hs.get_device_handler().device_list_updater
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.clock = hs.get_clock() self.clock = hs.get_clock()
@staticmethod @staticmethod

View File

@ -68,7 +68,7 @@ class ReplicationFederationSendEventsRestServlet(ReplicationEndpoint):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__(hs) super().__init__(hs)
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.storage = hs.get_storage() self.storage = hs.get_storage()
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.federation_event_handler = hs.get_federation_event_handler() self.federation_event_handler = hs.get_federation_event_handler()
@ -167,7 +167,7 @@ class ReplicationFederationSendEduRestServlet(ReplicationEndpoint):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__(hs) super().__init__(hs)
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.registry = hs.get_federation_registry() self.registry = hs.get_federation_registry()
@ -214,7 +214,7 @@ class ReplicationGetQueryRestServlet(ReplicationEndpoint):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__(hs) super().__init__(hs)
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.registry = hs.get_federation_registry() self.registry = hs.get_federation_registry()
@ -260,7 +260,7 @@ class ReplicationCleanRoomRestServlet(ReplicationEndpoint):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__(hs) super().__init__(hs)
self.store = hs.get_datastore() self.store = hs.get_datastores().main
@staticmethod @staticmethod
async def _serialize_payload(room_id: str) -> JsonDict: # type: ignore[override] async def _serialize_payload(room_id: str) -> JsonDict: # type: ignore[override]
@ -297,7 +297,7 @@ class ReplicationStoreRoomOnOutlierMembershipRestServlet(ReplicationEndpoint):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__(hs) super().__init__(hs)
self.store = hs.get_datastore() self.store = hs.get_datastores().main
@staticmethod @staticmethod
async def _serialize_payload(room_id: str, room_version: RoomVersion) -> JsonDict: # type: ignore[override] async def _serialize_payload(room_id: str, room_version: RoomVersion) -> JsonDict: # type: ignore[override]

View File

@ -50,7 +50,7 @@ class ReplicationRemoteJoinRestServlet(ReplicationEndpoint):
super().__init__(hs) super().__init__(hs)
self.federation_handler = hs.get_federation_handler() self.federation_handler = hs.get_federation_handler()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.clock = hs.get_clock() self.clock = hs.get_clock()
@staticmethod @staticmethod
@ -119,7 +119,7 @@ class ReplicationRemoteKnockRestServlet(ReplicationEndpoint):
super().__init__(hs) super().__init__(hs)
self.federation_handler = hs.get_federation_handler() self.federation_handler = hs.get_federation_handler()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.clock = hs.get_clock() self.clock = hs.get_clock()
@staticmethod @staticmethod
@ -188,7 +188,7 @@ class ReplicationRemoteRejectInviteRestServlet(ReplicationEndpoint):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__(hs) super().__init__(hs)
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.member_handler = hs.get_room_member_handler() self.member_handler = hs.get_room_member_handler()
@ -258,7 +258,7 @@ class ReplicationRemoteRescindKnockRestServlet(ReplicationEndpoint):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__(hs) super().__init__(hs)
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.member_handler = hs.get_room_member_handler() self.member_handler = hs.get_room_member_handler()
@ -325,7 +325,7 @@ class ReplicationUserJoinedLeftRoomRestServlet(ReplicationEndpoint):
super().__init__(hs) super().__init__(hs)
self.registeration_handler = hs.get_registration_handler() self.registeration_handler = hs.get_registration_handler()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.distributor = hs.get_distributor() self.distributor = hs.get_distributor()

View File

@ -36,7 +36,7 @@ class ReplicationRegisterServlet(ReplicationEndpoint):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__(hs) super().__init__(hs)
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.registration_handler = hs.get_registration_handler() self.registration_handler = hs.get_registration_handler()
@staticmethod @staticmethod
@ -112,7 +112,7 @@ class ReplicationPostRegisterActionsServlet(ReplicationEndpoint):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__(hs) super().__init__(hs)
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.registration_handler = hs.get_registration_handler() self.registration_handler = hs.get_registration_handler()
@staticmethod @staticmethod

View File

@ -69,7 +69,7 @@ class ReplicationSendEventRestServlet(ReplicationEndpoint):
super().__init__(hs) super().__init__(hs)
self.event_creation_handler = hs.get_event_creation_handler() self.event_creation_handler = hs.get_event_creation_handler()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.storage = hs.get_storage() self.storage = hs.get_storage()
self.clock = hs.get_clock() self.clock = hs.get_clock()

View File

@ -111,7 +111,7 @@ class ReplicationDataHandler:
""" """
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.notifier = hs.get_notifier() self.notifier = hs.get_notifier()
self._reactor = hs.get_reactor() self._reactor = hs.get_reactor()
self._clock = hs.get_clock() self._clock = hs.get_clock()
@ -340,7 +340,7 @@ class FederationSenderHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
assert hs.should_send_federation() assert hs.should_send_federation()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self._is_mine_id = hs.is_mine_id self._is_mine_id = hs.is_mine_id
self._hs = hs self._hs = hs

View File

@ -95,7 +95,7 @@ class ReplicationCommandHandler:
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._replication_data_handler = hs.get_replication_data_handler() self._replication_data_handler = hs.get_replication_data_handler()
self._presence_handler = hs.get_presence_handler() self._presence_handler = hs.get_presence_handler()
self._store = hs.get_datastore() self._store = hs.get_datastores().main
self._notifier = hs.get_notifier() self._notifier = hs.get_notifier()
self._clock = hs.get_clock() self._clock = hs.get_clock()
self._instance_id = hs.get_instance_id() self._instance_id = hs.get_instance_id()

View File

@ -72,7 +72,7 @@ class ReplicationStreamer:
""" """
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.notifier = hs.get_notifier() self.notifier = hs.get_notifier()
self._instance_name = hs.get_instance_name() self._instance_name = hs.get_instance_name()

View File

@ -239,7 +239,7 @@ class BackfillStream(Stream):
ROW_TYPE = BackfillStreamRow ROW_TYPE = BackfillStreamRow
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
super().__init__( super().__init__(
hs.get_instance_name(), hs.get_instance_name(),
self._current_token, self._current_token,
@ -267,7 +267,7 @@ class PresenceStream(Stream):
ROW_TYPE = PresenceStreamRow ROW_TYPE = PresenceStreamRow
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
store = hs.get_datastore() store = hs.get_datastores().main
if hs.get_instance_name() in hs.config.worker.writers.presence: if hs.get_instance_name() in hs.config.worker.writers.presence:
# on the presence writer, query the presence handler # on the presence writer, query the presence handler
@ -355,7 +355,7 @@ class ReceiptsStream(Stream):
ROW_TYPE = ReceiptsStreamRow ROW_TYPE = ReceiptsStreamRow
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
store = hs.get_datastore() store = hs.get_datastores().main
super().__init__( super().__init__(
hs.get_instance_name(), hs.get_instance_name(),
current_token_without_instance(store.get_max_receipt_stream_id), current_token_without_instance(store.get_max_receipt_stream_id),
@ -374,7 +374,7 @@ class PushRulesStream(Stream):
ROW_TYPE = PushRulesStreamRow ROW_TYPE = PushRulesStreamRow
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
super().__init__( super().__init__(
hs.get_instance_name(), hs.get_instance_name(),
@ -401,7 +401,7 @@ class PushersStream(Stream):
ROW_TYPE = PushersStreamRow ROW_TYPE = PushersStreamRow
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
store = hs.get_datastore() store = hs.get_datastores().main
super().__init__( super().__init__(
hs.get_instance_name(), hs.get_instance_name(),
@ -434,7 +434,7 @@ class CachesStream(Stream):
ROW_TYPE = CachesStreamRow ROW_TYPE = CachesStreamRow
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
store = hs.get_datastore() store = hs.get_datastores().main
super().__init__( super().__init__(
hs.get_instance_name(), hs.get_instance_name(),
store.get_cache_stream_token_for_writer, store.get_cache_stream_token_for_writer,
@ -455,7 +455,7 @@ class DeviceListsStream(Stream):
ROW_TYPE = DeviceListsStreamRow ROW_TYPE = DeviceListsStreamRow
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
store = hs.get_datastore() store = hs.get_datastores().main
super().__init__( super().__init__(
hs.get_instance_name(), hs.get_instance_name(),
current_token_without_instance(store.get_device_stream_token), current_token_without_instance(store.get_device_stream_token),
@ -474,7 +474,7 @@ class ToDeviceStream(Stream):
ROW_TYPE = ToDeviceStreamRow ROW_TYPE = ToDeviceStreamRow
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
store = hs.get_datastore() store = hs.get_datastores().main
super().__init__( super().__init__(
hs.get_instance_name(), hs.get_instance_name(),
current_token_without_instance(store.get_to_device_stream_token), current_token_without_instance(store.get_to_device_stream_token),
@ -495,7 +495,7 @@ class TagAccountDataStream(Stream):
ROW_TYPE = TagAccountDataStreamRow ROW_TYPE = TagAccountDataStreamRow
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
store = hs.get_datastore() store = hs.get_datastores().main
super().__init__( super().__init__(
hs.get_instance_name(), hs.get_instance_name(),
current_token_without_instance(store.get_max_account_data_stream_id), current_token_without_instance(store.get_max_account_data_stream_id),
@ -516,7 +516,7 @@ class AccountDataStream(Stream):
ROW_TYPE = AccountDataStreamRow ROW_TYPE = AccountDataStreamRow
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
super().__init__( super().__init__(
hs.get_instance_name(), hs.get_instance_name(),
current_token_without_instance(self.store.get_max_account_data_stream_id), current_token_without_instance(self.store.get_max_account_data_stream_id),
@ -585,7 +585,7 @@ class GroupServerStream(Stream):
ROW_TYPE = GroupsStreamRow ROW_TYPE = GroupsStreamRow
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
store = hs.get_datastore() store = hs.get_datastores().main
super().__init__( super().__init__(
hs.get_instance_name(), hs.get_instance_name(),
current_token_without_instance(store.get_group_stream_token), current_token_without_instance(store.get_group_stream_token),
@ -604,7 +604,7 @@ class UserSignatureStream(Stream):
ROW_TYPE = UserSignatureStreamRow ROW_TYPE = UserSignatureStreamRow
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
store = hs.get_datastore() store = hs.get_datastores().main
super().__init__( super().__init__(
hs.get_instance_name(), hs.get_instance_name(),
current_token_without_instance(store.get_device_stream_token), current_token_without_instance(store.get_device_stream_token),

View File

@ -124,7 +124,7 @@ class EventsStream(Stream):
NAME = "events" NAME = "events"
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._store = hs.get_datastore() self._store = hs.get_datastores().main
super().__init__( super().__init__(
hs.get_instance_name(), hs.get_instance_name(),
self._store._stream_id_gen.get_current_token_for_writer, self._store._stream_id_gen.get_current_token_for_writer,

View File

@ -116,7 +116,7 @@ class PurgeHistoryRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.pagination_handler = hs.get_pagination_handler() self.pagination_handler = hs.get_pagination_handler()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
async def on_POST( async def on_POST(

View File

@ -112,7 +112,7 @@ class BackgroundUpdateStartJobRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._auth = hs.get_auth() self._auth = hs.get_auth()
self._store = hs.get_datastore() self._store = hs.get_datastores().main
async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]: async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
await assert_requester_is_admin(self._auth, request) await assert_requester_is_admin(self._auth, request)

View File

@ -44,7 +44,7 @@ class DeviceRestServlet(RestServlet):
super().__init__() super().__init__()
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.device_handler = hs.get_device_handler() self.device_handler = hs.get_device_handler()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.is_mine = hs.is_mine self.is_mine = hs.is_mine
async def on_GET( async def on_GET(
@ -113,7 +113,7 @@ class DevicesRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.device_handler = hs.get_device_handler() self.device_handler = hs.get_device_handler()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.is_mine = hs.is_mine self.is_mine = hs.is_mine
async def on_GET( async def on_GET(
@ -144,7 +144,7 @@ class DeleteDevicesRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.device_handler = hs.get_device_handler() self.device_handler = hs.get_device_handler()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.is_mine = hs.is_mine self.is_mine = hs.is_mine
async def on_POST( async def on_POST(

View File

@ -53,7 +53,7 @@ class EventReportsRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]: async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
await assert_requester_is_admin(self.auth, request) await assert_requester_is_admin(self.auth, request)
@ -115,7 +115,7 @@ class EventReportDetailRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def on_GET( async def on_GET(
self, request: SynapseRequest, report_id: str self, request: SynapseRequest, report_id: str

View File

@ -48,7 +48,7 @@ class ListDestinationsRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._auth = hs.get_auth() self._auth = hs.get_auth()
self._store = hs.get_datastore() self._store = hs.get_datastores().main
async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]: async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
await assert_requester_is_admin(self._auth, request) await assert_requester_is_admin(self._auth, request)
@ -105,7 +105,7 @@ class DestinationRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._auth = hs.get_auth() self._auth = hs.get_auth()
self._store = hs.get_datastore() self._store = hs.get_datastores().main
async def on_GET( async def on_GET(
self, request: SynapseRequest, destination: str self, request: SynapseRequest, destination: str
@ -165,7 +165,7 @@ class DestinationMembershipRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._auth = hs.get_auth() self._auth = hs.get_auth()
self._store = hs.get_datastore() self._store = hs.get_datastores().main
async def on_GET( async def on_GET(
self, request: SynapseRequest, destination: str self, request: SynapseRequest, destination: str
@ -221,7 +221,7 @@ class DestinationResetConnectionRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._auth = hs.get_auth() self._auth = hs.get_auth()
self._store = hs.get_datastore() self._store = hs.get_datastores().main
self._authenticator = Authenticator(hs) self._authenticator = Authenticator(hs)
async def on_POST( async def on_POST(

View File

@ -47,7 +47,7 @@ class QuarantineMediaInRoom(RestServlet):
] ]
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
async def on_POST( async def on_POST(
@ -74,7 +74,7 @@ class QuarantineMediaByUser(RestServlet):
PATTERNS = admin_patterns("/user/(?P<user_id>[^/]*)/media/quarantine$") PATTERNS = admin_patterns("/user/(?P<user_id>[^/]*)/media/quarantine$")
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
async def on_POST( async def on_POST(
@ -103,7 +103,7 @@ class QuarantineMediaByID(RestServlet):
) )
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
async def on_POST( async def on_POST(
@ -132,7 +132,7 @@ class UnquarantineMediaByID(RestServlet):
) )
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
async def on_POST( async def on_POST(
@ -156,7 +156,7 @@ class ProtectMediaByID(RestServlet):
PATTERNS = admin_patterns("/media/protect/(?P<media_id>[^/]*)$") PATTERNS = admin_patterns("/media/protect/(?P<media_id>[^/]*)$")
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
async def on_POST( async def on_POST(
@ -178,7 +178,7 @@ class UnprotectMediaByID(RestServlet):
PATTERNS = admin_patterns("/media/unprotect/(?P<media_id>[^/]*)$") PATTERNS = admin_patterns("/media/unprotect/(?P<media_id>[^/]*)$")
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
async def on_POST( async def on_POST(
@ -200,7 +200,7 @@ class ListMediaInRoom(RestServlet):
PATTERNS = admin_patterns("/room/(?P<room_id>[^/]*)/media$") PATTERNS = admin_patterns("/room/(?P<room_id>[^/]*)/media$")
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
async def on_GET( async def on_GET(
@ -251,7 +251,7 @@ class DeleteMediaByID(RestServlet):
PATTERNS = admin_patterns("/media/(?P<server_name>[^/]*)/(?P<media_id>[^/]*)$") PATTERNS = admin_patterns("/media/(?P<server_name>[^/]*)/(?P<media_id>[^/]*)$")
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.server_name = hs.hostname self.server_name = hs.hostname
self.media_repository = hs.get_media_repository() self.media_repository = hs.get_media_repository()
@ -283,7 +283,7 @@ class DeleteMediaByDateSize(RestServlet):
PATTERNS = admin_patterns("/media/(?P<server_name>[^/]*)/delete$") PATTERNS = admin_patterns("/media/(?P<server_name>[^/]*)/delete$")
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.server_name = hs.hostname self.server_name = hs.hostname
self.media_repository = hs.get_media_repository() self.media_repository = hs.get_media_repository()
@ -352,7 +352,7 @@ class UserMediaRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.is_mine = hs.is_mine self.is_mine = hs.is_mine
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.media_repository = hs.get_media_repository() self.media_repository = hs.get_media_repository()
async def on_GET( async def on_GET(

View File

@ -71,7 +71,7 @@ class ListRegistrationTokensRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]: async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
await assert_requester_is_admin(self.auth, request) await assert_requester_is_admin(self.auth, request)
@ -109,7 +109,7 @@ class NewRegistrationTokenRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.clock = hs.get_clock() self.clock = hs.get_clock()
# A string of all the characters allowed to be in a registration_token # A string of all the characters allowed to be in a registration_token
self.allowed_chars = string.ascii_letters + string.digits + "._~-" self.allowed_chars = string.ascii_letters + string.digits + "._~-"
@ -260,7 +260,7 @@ class RegistrationTokenRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def on_GET(self, request: SynapseRequest, token: str) -> Tuple[int, JsonDict]: async def on_GET(self, request: SynapseRequest, token: str) -> Tuple[int, JsonDict]:
"""Retrieve a registration token.""" """Retrieve a registration token."""

View File

@ -65,7 +65,7 @@ class RoomRestV2Servlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._auth = hs.get_auth() self._auth = hs.get_auth()
self._store = hs.get_datastore() self._store = hs.get_datastores().main
self._pagination_handler = hs.get_pagination_handler() self._pagination_handler = hs.get_pagination_handler()
async def on_DELETE( async def on_DELETE(
@ -188,7 +188,7 @@ class ListRoomRestServlet(RestServlet):
PATTERNS = admin_patterns("/rooms$") PATTERNS = admin_patterns("/rooms$")
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.admin_handler = hs.get_admin_handler() self.admin_handler = hs.get_admin_handler()
@ -278,7 +278,7 @@ class RoomRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.room_shutdown_handler = hs.get_room_shutdown_handler() self.room_shutdown_handler = hs.get_room_shutdown_handler()
self.pagination_handler = hs.get_pagination_handler() self.pagination_handler = hs.get_pagination_handler()
@ -382,7 +382,7 @@ class RoomMembersRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def on_GET( async def on_GET(
self, request: SynapseRequest, room_id: str self, request: SynapseRequest, room_id: str
@ -408,7 +408,7 @@ class RoomStateRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.clock = hs.get_clock() self.clock = hs.get_clock()
self._event_serializer = hs.get_event_client_serializer() self._event_serializer = hs.get_event_client_serializer()
@ -525,7 +525,7 @@ class MakeRoomAdminRestServlet(ResolveRoomIdMixin, RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__(hs) super().__init__(hs)
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.event_creation_handler = hs.get_event_creation_handler() self.event_creation_handler = hs.get_event_creation_handler()
self.state_handler = hs.get_state_handler() self.state_handler = hs.get_state_handler()
self.is_mine_id = hs.is_mine_id self.is_mine_id = hs.is_mine_id
@ -670,7 +670,7 @@ class ForwardExtremitiesRestServlet(ResolveRoomIdMixin, RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__(hs) super().__init__(hs)
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def on_DELETE( async def on_DELETE(
self, request: SynapseRequest, room_identifier: str self, request: SynapseRequest, room_identifier: str
@ -781,7 +781,7 @@ class BlockRoomRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._auth = hs.get_auth() self._auth = hs.get_auth()
self._store = hs.get_datastore() self._store = hs.get_datastores().main
async def on_GET( async def on_GET(
self, request: SynapseRequest, room_id: str self, request: SynapseRequest, room_id: str

View File

@ -38,7 +38,7 @@ class UserMediaStatisticsRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]: async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
await assert_requester_is_admin(self.auth, request) await assert_requester_is_admin(self.auth, request)

View File

@ -66,7 +66,7 @@ class UsersRestServletV2(RestServlet):
""" """
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.admin_handler = hs.get_admin_handler() self.admin_handler = hs.get_admin_handler()
@ -156,7 +156,7 @@ class UserRestServletV2(RestServlet):
self.hs = hs self.hs = hs
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.admin_handler = hs.get_admin_handler() self.admin_handler = hs.get_admin_handler()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth_handler = hs.get_auth_handler() self.auth_handler = hs.get_auth_handler()
self.profile_handler = hs.get_profile_handler() self.profile_handler = hs.get_profile_handler()
self.set_password_handler = hs.get_set_password_handler() self.set_password_handler = hs.get_set_password_handler()
@ -588,7 +588,7 @@ class DeactivateAccountRestServlet(RestServlet):
self._deactivate_account_handler = hs.get_deactivate_account_handler() self._deactivate_account_handler = hs.get_deactivate_account_handler()
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.is_mine = hs.is_mine self.is_mine = hs.is_mine
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def on_POST( async def on_POST(
self, request: SynapseRequest, target_user_id: str self, request: SynapseRequest, target_user_id: str
@ -674,7 +674,7 @@ class ResetPasswordRestServlet(RestServlet):
PATTERNS = admin_patterns("/reset_password/(?P<target_user_id>[^/]*)$") PATTERNS = admin_patterns("/reset_password/(?P<target_user_id>[^/]*)$")
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.auth_handler = hs.get_auth_handler() self.auth_handler = hs.get_auth_handler()
self._set_password_handler = hs.get_set_password_handler() self._set_password_handler = hs.get_set_password_handler()
@ -717,7 +717,7 @@ class SearchUsersRestServlet(RestServlet):
PATTERNS = admin_patterns("/search_users/(?P<target_user_id>[^/]*)$") PATTERNS = admin_patterns("/search_users/(?P<target_user_id>[^/]*)$")
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.is_mine = hs.is_mine self.is_mine = hs.is_mine
@ -775,7 +775,7 @@ class UserAdminServlet(RestServlet):
PATTERNS = admin_patterns("/users/(?P<user_id>[^/]*)/admin$") PATTERNS = admin_patterns("/users/(?P<user_id>[^/]*)/admin$")
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.is_mine = hs.is_mine self.is_mine = hs.is_mine
@ -835,7 +835,7 @@ class UserMembershipRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.is_mine = hs.is_mine self.is_mine = hs.is_mine
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def on_GET( async def on_GET(
self, request: SynapseRequest, user_id: str self, request: SynapseRequest, user_id: str
@ -864,7 +864,7 @@ class PushersRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.is_mine = hs.is_mine self.is_mine = hs.is_mine
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
async def on_GET( async def on_GET(
@ -905,7 +905,7 @@ class UserTokenRestServlet(RestServlet):
PATTERNS = admin_patterns("/users/(?P<user_id>[^/]*)/login$") PATTERNS = admin_patterns("/users/(?P<user_id>[^/]*)/login$")
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.auth_handler = hs.get_auth_handler() self.auth_handler = hs.get_auth_handler()
self.is_mine_id = hs.is_mine_id self.is_mine_id = hs.is_mine_id
@ -974,7 +974,7 @@ class ShadowBanRestServlet(RestServlet):
PATTERNS = admin_patterns("/users/(?P<user_id>[^/]*)/shadow_ban$") PATTERNS = admin_patterns("/users/(?P<user_id>[^/]*)/shadow_ban$")
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.is_mine_id = hs.is_mine_id self.is_mine_id = hs.is_mine_id
@ -1026,7 +1026,7 @@ class RateLimitRestServlet(RestServlet):
PATTERNS = admin_patterns("/users/(?P<user_id>[^/]*)/override_ratelimit$") PATTERNS = admin_patterns("/users/(?P<user_id>[^/]*)/override_ratelimit$")
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.is_mine_id = hs.is_mine_id self.is_mine_id = hs.is_mine_id
@ -1129,7 +1129,7 @@ class AccountDataRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self._auth = hs.get_auth() self._auth = hs.get_auth()
self._store = hs.get_datastore() self._store = hs.get_datastores().main
self._is_mine_id = hs.is_mine_id self._is_mine_id = hs.is_mine_id
async def on_GET( async def on_GET(

View File

@ -60,7 +60,7 @@ class EmailPasswordRequestTokenRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__() super().__init__()
self.hs = hs self.hs = hs
self.datastore = hs.get_datastore() self.datastore = hs.get_datastores().main
self.config = hs.config self.config = hs.config
self.identity_handler = hs.get_identity_handler() self.identity_handler = hs.get_identity_handler()
@ -114,7 +114,7 @@ class EmailPasswordRequestTokenRestServlet(RestServlet):
# This avoids a potential account hijack by requesting a password reset to # This avoids a potential account hijack by requesting a password reset to
# an email address which is controlled by the attacker but which, after # an email address which is controlled by the attacker but which, after
# canonicalisation, matches the one in our database. # canonicalisation, matches the one in our database.
existing_user_id = await self.hs.get_datastore().get_user_id_by_threepid( existing_user_id = await self.hs.get_datastores().main.get_user_id_by_threepid(
"email", email "email", email
) )
@ -168,7 +168,7 @@ class PasswordRestServlet(RestServlet):
self.hs = hs self.hs = hs
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.auth_handler = hs.get_auth_handler() self.auth_handler = hs.get_auth_handler()
self.datastore = self.hs.get_datastore() self.datastore = self.hs.get_datastores().main
self.password_policy_handler = hs.get_password_policy_handler() self.password_policy_handler = hs.get_password_policy_handler()
self._set_password_handler = hs.get_set_password_handler() self._set_password_handler = hs.get_set_password_handler()
@ -347,7 +347,7 @@ class EmailThreepidRequestTokenRestServlet(RestServlet):
self.hs = hs self.hs = hs
self.config = hs.config self.config = hs.config
self.identity_handler = hs.get_identity_handler() self.identity_handler = hs.get_identity_handler()
self.store = self.hs.get_datastore() self.store = self.hs.get_datastores().main
if self.config.email.threepid_behaviour_email == ThreepidBehaviour.LOCAL: if self.config.email.threepid_behaviour_email == ThreepidBehaviour.LOCAL:
self.mailer = Mailer( self.mailer = Mailer(
@ -450,7 +450,7 @@ class MsisdnThreepidRequestTokenRestServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
self.hs = hs self.hs = hs
super().__init__() super().__init__()
self.store = self.hs.get_datastore() self.store = self.hs.get_datastores().main
self.identity_handler = hs.get_identity_handler() self.identity_handler = hs.get_identity_handler()
async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]: async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
@ -533,7 +533,7 @@ class AddThreepidEmailSubmitTokenServlet(RestServlet):
super().__init__() super().__init__()
self.config = hs.config self.config = hs.config
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
if self.config.email.threepid_behaviour_email == ThreepidBehaviour.LOCAL: if self.config.email.threepid_behaviour_email == ThreepidBehaviour.LOCAL:
self._failure_email_template = ( self._failure_email_template = (
self.config.email.email_add_threepid_template_failure_html self.config.email.email_add_threepid_template_failure_html
@ -600,7 +600,7 @@ class AddThreepidMsisdnSubmitTokenServlet(RestServlet):
super().__init__() super().__init__()
self.config = hs.config self.config = hs.config
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.identity_handler = hs.get_identity_handler() self.identity_handler = hs.get_identity_handler()
async def on_POST(self, request: Request) -> Tuple[int, JsonDict]: async def on_POST(self, request: Request) -> Tuple[int, JsonDict]:
@ -634,7 +634,7 @@ class ThreepidRestServlet(RestServlet):
self.identity_handler = hs.get_identity_handler() self.identity_handler = hs.get_identity_handler()
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.auth_handler = hs.get_auth_handler() self.auth_handler = hs.get_auth_handler()
self.datastore = self.hs.get_datastore() self.datastore = self.hs.get_datastores().main
async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]: async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
requester = await self.auth.get_user_by_req(request) requester = await self.auth.get_user_by_req(request)
@ -768,7 +768,7 @@ class ThreepidUnbindRestServlet(RestServlet):
self.hs = hs self.hs = hs
self.identity_handler = hs.get_identity_handler() self.identity_handler = hs.get_identity_handler()
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.datastore = self.hs.get_datastore() self.datastore = self.hs.get_datastores().main
async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]: async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
"""Unbind the given 3pid from a specific identity server, or identity servers that are """Unbind the given 3pid from a specific identity server, or identity servers that are

View File

@ -42,7 +42,7 @@ class AccountDataServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__() super().__init__()
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.handler = hs.get_account_data_handler() self.handler = hs.get_account_data_handler()
async def on_PUT( async def on_PUT(
@ -90,7 +90,7 @@ class RoomAccountDataServlet(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__() super().__init__()
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.handler = hs.get_account_data_handler() self.handler = hs.get_account_data_handler()
async def on_PUT( async def on_PUT(

View File

@ -47,7 +47,7 @@ class ClientDirectoryServer(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__() super().__init__()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.directory_handler = hs.get_directory_handler() self.directory_handler = hs.get_directory_handler()
self.auth = hs.get_auth() self.auth = hs.get_auth()
@ -129,7 +129,7 @@ class ClientDirectoryListServer(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__() super().__init__()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.directory_handler = hs.get_directory_handler() self.directory_handler = hs.get_directory_handler()
self.auth = hs.get_auth() self.auth = hs.get_auth()
@ -173,7 +173,7 @@ class ClientAppserviceDirectoryListServer(RestServlet):
def __init__(self, hs: "HomeServer"): def __init__(self, hs: "HomeServer"):
super().__init__() super().__init__()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.directory_handler = hs.get_directory_handler() self.directory_handler = hs.get_directory_handler()
self.auth = hs.get_auth() self.auth = hs.get_auth()

View File

@ -39,7 +39,7 @@ class EventStreamRestServlet(RestServlet):
super().__init__() super().__init__()
self.event_stream_handler = hs.get_event_stream_handler() self.event_stream_handler = hs.get_event_stream_handler()
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]: async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
requester = await self.auth.get_user_by_req(request, allow_guest=True) requester = await self.auth.get_user_by_req(request, allow_guest=True)

View File

@ -705,7 +705,7 @@ class GroupAdminUsersInviteServlet(RestServlet):
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.groups_handler = hs.get_groups_local_handler() self.groups_handler = hs.get_groups_local_handler()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.is_mine_id = hs.is_mine_id self.is_mine_id = hs.is_mine_id
@_validate_group_id @_validate_group_id
@ -854,7 +854,7 @@ class GroupSelfUpdatePublicityServlet(RestServlet):
super().__init__() super().__init__()
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
@_validate_group_id @_validate_group_id
async def on_PUT( async def on_PUT(
@ -879,7 +879,7 @@ class PublicisedGroupsForUserServlet(RestServlet):
super().__init__() super().__init__()
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.groups_handler = hs.get_groups_local_handler() self.groups_handler = hs.get_groups_local_handler()
async def on_GET( async def on_GET(
@ -901,7 +901,7 @@ class PublicisedGroupsForUsersServlet(RestServlet):
super().__init__() super().__init__()
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.clock = hs.get_clock() self.clock = hs.get_clock()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
self.groups_handler = hs.get_groups_local_handler() self.groups_handler = hs.get_groups_local_handler()
async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]: async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]:

View File

@ -33,7 +33,7 @@ class InitialSyncRestServlet(RestServlet):
super().__init__() super().__init__()
self.initial_sync_handler = hs.get_initial_sync_handler() self.initial_sync_handler = hs.get_initial_sync_handler()
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]: async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
requester = await self.auth.get_user_by_req(request) requester = await self.auth.get_user_by_req(request)

View File

@ -198,7 +198,7 @@ class KeyChangesServlet(RestServlet):
super().__init__() super().__init__()
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.device_handler = hs.get_device_handler() self.device_handler = hs.get_device_handler()
self.store = hs.get_datastore() self.store = hs.get_datastores().main
async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]: async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
requester = await self.auth.get_user_by_req(request, allow_guest=True) requester = await self.auth.get_user_by_req(request, allow_guest=True)

Some files were not shown because too many files have changed in this diff Show More