diff --git a/swh/objstorage/__init__.py b/swh/objstorage/__init__.py --- a/swh/objstorage/__init__.py +++ b/swh/objstorage/__init__.py @@ -3,14 +3,14 @@ # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information -from .objstorage import ObjStorage -from .objstorage_pathslicing import PathSlicingObjStorage -from .objstorage_in_memory import InMemoryObjStorage -from .api.client import RemoteObjStorage -from .multiplexer import MultiplexerObjStorage, StripingObjStorage -from .multiplexer.filter import add_filters - -from swh.objstorage.objstorage_weed import WeedObjStorage +from swh.objstorage.objstorage import ObjStorage, ID_HASH_LENGTH # noqa +from swh.objstorage.backends.pathslicing import PathSlicingObjStorage +from swh.objstorage.backends.in_memory import InMemoryObjStorage +from swh.objstorage.api.client import RemoteObjStorage +from swh.objstorage.multiplexer import ( + MultiplexerObjStorage, StripingObjStorage) +from swh.objstorage.multiplexer.filter import add_filters +from swh.objstorage.backends.seaweed import WeedObjStorage __all__ = ['get_objstorage', 'ObjStorage'] @@ -26,7 +26,7 @@ } try: - from swh.objstorage.cloud.objstorage_azure import ( + from swh.objstorage.backends.azure import ( AzureCloudObjStorage, PrefixedAzureCloudObjStorage, ) @@ -37,13 +37,13 @@ _STORAGE_CLASSES_MISSING['azure-prefixed'] = e.args[0] try: - from swh.objstorage.objstorage_rados import RADOSObjStorage + from swh.objstorage.backends.rados import RADOSObjStorage _STORAGE_CLASSES['rados'] = RADOSObjStorage except ImportError as e: _STORAGE_CLASSES_MISSING['rados'] = e.args[0] try: - from swh.objstorage.cloud.objstorage_cloud import ( + from swh.objstorage.backends.libcloud import ( AwsCloudObjStorage, OpenStackCloudObjStorage, ) diff --git a/swh/objstorage/backends/__init__.py b/swh/objstorage/backends/__init__.py new file mode 100644 diff --git a/swh/objstorage/cloud/objstorage_azure.py b/swh/objstorage/backends/azure.py rename from swh/objstorage/cloud/objstorage_azure.py rename to swh/objstorage/backends/azure.py diff --git a/swh/objstorage/objstorage_in_memory.py b/swh/objstorage/backends/in_memory.py rename from swh/objstorage/objstorage_in_memory.py rename to swh/objstorage/backends/in_memory.py diff --git a/swh/objstorage/cloud/objstorage_cloud.py b/swh/objstorage/backends/libcloud.py rename from swh/objstorage/cloud/objstorage_cloud.py rename to swh/objstorage/backends/libcloud.py diff --git a/swh/objstorage/objstorage_pathslicing.py b/swh/objstorage/backends/pathslicing.py rename from swh/objstorage/objstorage_pathslicing.py rename to swh/objstorage/backends/pathslicing.py --- a/swh/objstorage/objstorage_pathslicing.py +++ b/swh/objstorage/backends/pathslicing.py @@ -15,9 +15,10 @@ from swh.model import hashutil -from .objstorage import (ObjStorage, compute_hash, ID_HASH_ALGO, - ID_HASH_LENGTH, DEFAULT_CHUNK_SIZE, DEFAULT_LIMIT) -from .exc import ObjNotFoundError, Error +from swh.objstorage.objstorage import ( + ObjStorage, compute_hash, ID_HASH_ALGO, + ID_HASH_LENGTH, DEFAULT_CHUNK_SIZE, DEFAULT_LIMIT) +from swh.objstorage.exc import ObjNotFoundError, Error GZIP_BUFSIZ = 1048576 diff --git a/swh/objstorage/objstorage_rados.py b/swh/objstorage/backends/rados.py rename from swh/objstorage/objstorage_rados.py rename to swh/objstorage/backends/rados.py diff --git a/swh/objstorage/objstorage_weed.py b/swh/objstorage/backends/seaweed.py rename from swh/objstorage/objstorage_weed.py rename to swh/objstorage/backends/seaweed.py diff --git a/swh/objstorage/cloud/__init__.py b/swh/objstorage/cloud/__init__.py deleted file mode 100644 --- a/swh/objstorage/cloud/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -from .objstorage_cloud import AwsCloudObjStorage, OpenStackCloudObjStorage -from .objstorage_azure import AzureCloudObjStorage - - -__all__ = [ - 'AwsCloudObjStorage', - 'OpenStackCloudObjStorage', - 'AzureCloudObjStorage', -] diff --git a/swh/objstorage/tests/test_objstorage_azure.py b/swh/objstorage/tests/test_objstorage_azure.py --- a/swh/objstorage/tests/test_objstorage_azure.py +++ b/swh/objstorage/tests/test_objstorage_azure.py @@ -68,7 +68,7 @@ def setUp(self): super().setUp() patcher = patch( - 'swh.objstorage.cloud.objstorage_azure.BlockBlobService', + 'swh.objstorage.backends.azure.BlockBlobService', MockBlockBlobService, ) patcher.start() @@ -86,7 +86,7 @@ def setUp(self): super().setUp() patcher = patch( - 'swh.objstorage.cloud.objstorage_azure.BlockBlobService', + 'swh.objstorage.backends.azure.BlockBlobService', MockBlockBlobService, ) patcher.start() diff --git a/swh/objstorage/tests/test_objstorage_cloud.py b/swh/objstorage/tests/test_objstorage_cloud.py --- a/swh/objstorage/tests/test_objstorage_cloud.py +++ b/swh/objstorage/tests/test_objstorage_cloud.py @@ -12,7 +12,7 @@ from libcloud.storage.types import (ContainerDoesNotExistError, ObjectDoesNotExistError) from swh.model import hashutil -from swh.objstorage.cloud.objstorage_cloud import CloudObjStorage +from swh.objstorage.backends.libcloud import CloudObjStorage from .objstorage_testing import ObjStorageTestFixture diff --git a/swh/objstorage/tests/test_objstorage_instantiation.py b/swh/objstorage/tests/test_objstorage_instantiation.py --- a/swh/objstorage/tests/test_objstorage_instantiation.py +++ b/swh/objstorage/tests/test_objstorage_instantiation.py @@ -9,7 +9,7 @@ from swh.objstorage import get_objstorage from swh.objstorage.api.client import RemoteObjStorage -from swh.objstorage.objstorage_pathslicing import PathSlicingObjStorage +from swh.objstorage.backends.pathslicing import PathSlicingObjStorage class TestObjStorageInitialization(unittest.TestCase):