Changeset View
Changeset View
Standalone View
Standalone View
swh/objstorage/factory.py
| # Copyright (C) 2016-2021 The Software Heritage developers | # Copyright (C) 2016-2021 The Software Heritage developers | ||||
| # See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
| # License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
| # See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
| from typing import Callable, Dict, Union | from typing import Callable, Dict, Union | ||||
| import warnings | import warnings | ||||
| from swh.objstorage.api.client import RemoteObjStorage | from swh.objstorage.api.client import RemoteObjStorage | ||||
| from swh.objstorage.backends.generator import RandomGeneratorObjStorage | from swh.objstorage.backends.generator import RandomGeneratorObjStorage | ||||
| from swh.objstorage.backends.http import HTTPReadOnlyObjStorage | from swh.objstorage.backends.http import HTTPReadOnlyObjStorage | ||||
| from swh.objstorage.backends.in_memory import InMemoryObjStorage | from swh.objstorage.backends.in_memory import InMemoryObjStorage | ||||
| from swh.objstorage.backends.noop import NoopObjStorage | from swh.objstorage.backends.noop import NoopObjStorage | ||||
| from swh.objstorage.backends.pathslicing import PathSlicingObjStorage | from swh.objstorage.backends.pathslicing import PathSlicingObjStorage | ||||
| from swh.objstorage.backends.seaweedfs import SeaweedFilerObjStorage | from swh.objstorage.backends.seaweedfs import SeaweedFilerObjStorage | ||||
| from swh.objstorage.backends.winery import WineryObjStorage | |||||
| from swh.objstorage.multiplexer import MultiplexerObjStorage, StripingObjStorage | from swh.objstorage.multiplexer import MultiplexerObjStorage, StripingObjStorage | ||||
| from swh.objstorage.multiplexer.filter import add_filters | from swh.objstorage.multiplexer.filter import add_filters | ||||
| from swh.objstorage.objstorage import ID_HASH_LENGTH, ObjStorage # noqa | from swh.objstorage.objstorage import ID_HASH_LENGTH, ObjStorage # noqa | ||||
| __all__ = ["get_objstorage", "ObjStorage"] | __all__ = ["get_objstorage", "ObjStorage"] | ||||
| _STORAGE_CLASSES: Dict[str, Union[type, Callable[..., type]]] = { | _STORAGE_CLASSES: Dict[str, Union[type, Callable[..., type]]] = { | ||||
| "pathslicing": PathSlicingObjStorage, | "pathslicing": PathSlicingObjStorage, | ||||
| "remote": RemoteObjStorage, | "remote": RemoteObjStorage, | ||||
| "memory": InMemoryObjStorage, | "memory": InMemoryObjStorage, | ||||
| "seaweedfs": SeaweedFilerObjStorage, | "seaweedfs": SeaweedFilerObjStorage, | ||||
| "random": RandomGeneratorObjStorage, | "random": RandomGeneratorObjStorage, | ||||
| "http": HTTPReadOnlyObjStorage, | "http": HTTPReadOnlyObjStorage, | ||||
| "winery": WineryObjStorage, | |||||
| "noop": NoopObjStorage, | "noop": NoopObjStorage, | ||||
| } | } | ||||
| _STORAGE_CLASSES_MISSING = {} | _STORAGE_CLASSES_MISSING = {} | ||||
| _STORAGE_CLASSES_DEPRECATED = {"weed": "seaweedfs"} | _STORAGE_CLASSES_DEPRECATED = {"weed": "seaweedfs"} | ||||
| try: | try: | ||||
| from swh.objstorage.backends.azure import ( | from swh.objstorage.backends.azure import ( | ||||
| ▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines | |||||