From 760e6c61e6ecbe0f16649c7656663ac6919245a5 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 18 Jun 2024 11:15:50 +0100 Subject: [PATCH] Update storage provider interface --- synapse/media/media_storage.py | 2 +- synapse/media/storage_provider.py | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/synapse/media/media_storage.py b/synapse/media/media_storage.py index 731feedbe2..b77bfd7f3c 100644 --- a/synapse/media/media_storage.py +++ b/synapse/media/media_storage.py @@ -227,7 +227,7 @@ class MediaStorage: for provider in self.storage_providers: for path in paths: - res: Any = await provider.fetch(path, file_info, media_info, federation) + res: Any = await provider.fetch(path, file_info) if res: logger.debug("Streaming %s from %s", path, provider) return res diff --git a/synapse/media/storage_provider.py b/synapse/media/storage_provider.py index a71da3587c..3a92128faf 100644 --- a/synapse/media/storage_provider.py +++ b/synapse/media/storage_provider.py @@ -60,8 +60,6 @@ class StorageProvider(metaclass=abc.ABCMeta): self, path: str, file_info: FileInfo, - media_info: Optional[LocalMedia] = None, - federation: bool = False, ) -> Optional[Responder]: """Attempt to fetch the file described by file_info and stream it into writer. @@ -69,8 +67,6 @@ class StorageProvider(metaclass=abc.ABCMeta): Args: path: Relative path of file in local cache file_info: The metadata of the file. - media_info: metadata of the media item - federation: Whether the requested media is for a federation request Returns: Returns a Responder if the provider has the file, otherwise returns None. @@ -137,8 +133,6 @@ class StorageProviderWrapper(StorageProvider): self, path: str, file_info: FileInfo, - media_info: Optional[LocalMedia] = None, - federation: bool = False, ) -> Optional[Responder]: if file_info.url_cache: # Files in the URL preview cache definitely aren't stored here, @@ -147,9 +141,7 @@ class StorageProviderWrapper(StorageProvider): # store_file is supposed to return an Awaitable, but guard # against improper implementations. - return await maybe_awaitable( - self.backend.fetch(path, file_info, media_info, federation) - ) + return await maybe_awaitable(self.backend.fetch(path, file_info)) class FileStorageProviderBackend(StorageProvider):