diff --git a/swh/storage/__init__.py b/swh/storage/__init__.py --- a/swh/storage/__init__.py +++ b/swh/storage/__init__.py @@ -12,15 +12,18 @@ STORAGE_IMPLEMENTATIONS = { - "local": ".postgresql.storage.Storage", "remote": ".api.client.RemoteStorage", "memory": ".in_memory.InMemoryStorage", - "filter": ".filter.FilteringProxyStorage", - "buffer": ".buffer.BufferingProxyStorage", - "retry": ".retry.RetryingProxyStorage", "cassandra": ".cassandra.CassandraStorage", - "validate": ".validate.ValidatingProxyStorage", - "tenacious": ".tenacious.TenaciousProxyStorage", + "postgresql": ".postgresql.storage.Storage", + # deprecated + "local": ".postgresql.storage.Storage", + # proxy storages + "filter": ".proxies.filter.FilteringProxyStorage", + "buffer": ".proxies.buffer.BufferingProxyStorage", + "retry": ".proxies.retry.RetryingProxyStorage", + "validate": ".proxies.validate.ValidatingProxyStorage", + "tenacious": ".proxies.tenacious.TenaciousProxyStorage", } @@ -56,6 +59,12 @@ if cls == "pipeline": return get_storage_pipeline(**kwargs) + if cls == "local": + warnings.warn( + 'The "local" storage class is deprecated, use "postgresql" instead.', + DeprecationWarning, + ) + class_path = STORAGE_IMPLEMENTATIONS.get(cls) if class_path is None: raise ValueError( diff --git a/swh/storage/buffer.py b/swh/storage/proxies/buffer.py rename from swh/storage/buffer.py rename to swh/storage/proxies/buffer.py diff --git a/swh/storage/filter.py b/swh/storage/proxies/filter.py rename from swh/storage/filter.py rename to swh/storage/proxies/filter.py diff --git a/swh/storage/retry.py b/swh/storage/proxies/retry.py rename from swh/storage/retry.py rename to swh/storage/proxies/retry.py diff --git a/swh/storage/tenacious.py b/swh/storage/proxies/tenacious.py rename from swh/storage/tenacious.py rename to swh/storage/proxies/tenacious.py diff --git a/swh/storage/validate.py b/swh/storage/proxies/validate.py rename from swh/storage/validate.py rename to swh/storage/proxies/validate.py diff --git a/swh/storage/tests/test_buffer.py b/swh/storage/tests/test_buffer.py --- a/swh/storage/tests/test_buffer.py +++ b/swh/storage/tests/test_buffer.py @@ -7,7 +7,7 @@ from unittest.mock import Mock from swh.storage import get_storage -from swh.storage.buffer import BufferingProxyStorage +from swh.storage.proxies.buffer import BufferingProxyStorage def get_storage_with_buffer_config(**buffer_config) -> BufferingProxyStorage: diff --git a/swh/storage/tests/test_init.py b/swh/storage/tests/test_init.py --- a/swh/storage/tests/test_init.py +++ b/swh/storage/tests/test_init.py @@ -10,11 +10,11 @@ from swh.core.pytest_plugin import RPCTestAdapter from swh.storage import get_storage from swh.storage.api import client, server -from swh.storage.buffer import BufferingProxyStorage -from swh.storage.filter import FilteringProxyStorage from swh.storage.in_memory import InMemoryStorage from swh.storage.postgresql.storage import Storage as DbStorage -from swh.storage.retry import RetryingProxyStorage +from swh.storage.proxies.buffer import BufferingProxyStorage +from swh.storage.proxies.filter import FilteringProxyStorage +from swh.storage.proxies.retry import RetryingProxyStorage STORAGES = [ pytest.param(cls, real_class, kwargs, id=cls) diff --git a/swh/storage/tests/test_retry.py b/swh/storage/tests/test_retry.py --- a/swh/storage/tests/test_retry.py +++ b/swh/storage/tests/test_retry.py @@ -18,7 +18,7 @@ """In test context, we don't want to wait, make test faster """ - from swh.storage.retry import RetryingProxyStorage + from swh.storage.proxies.retry import RetryingProxyStorage for method_name, method in RetryingProxyStorage.__dict__.items(): if "_add" in method_name or "_update" in method_name: diff --git a/swh/storage/tests/test_tenacious.py b/swh/storage/tests/test_tenacious.py --- a/swh/storage/tests/test_tenacious.py +++ b/swh/storage/tests/test_tenacious.py @@ -14,7 +14,7 @@ from swh.model.tests.swh_model_data import TEST_OBJECTS from swh.storage import get_storage from swh.storage.in_memory import InMemoryStorage -from swh.storage.tenacious import TenaciousProxyStorage +from swh.storage.proxies.tenacious import TenaciousProxyStorage from swh.storage.tests.storage_data import StorageData from swh.storage.tests.storage_tests import ( TestStorageGeneratedData as _TestStorageGeneratedData,