Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7066167
D6538.id24042.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Subscribers
None
D6538.id24042.diff
View Options
diff --git a/mypy.ini b/mypy.ini
--- a/mypy.ini
+++ b/mypy.ini
@@ -17,8 +17,5 @@
[mypy-pytest.*]
ignore_missing_imports = True
-[mypy-rados.*]
-ignore_missing_imports = True
-
[mypy-requests_toolbelt.*]
ignore_missing_imports = True
diff --git a/requirements-test.txt b/requirements-test.txt
--- a/requirements-test.txt
+++ b/requirements-test.txt
@@ -1,7 +1,6 @@
apache-libcloud
azure-storage-blob >= 12.0, != 12.9.0 # version 12.9.0 breaks mypy https://github.com/Azure/azure-sdk-for-python/pull/20891
pytest
-python-cephlibs
requests_mock[fixture] >= 1.9
requests_toolbelt
types-pyyaml
diff --git a/swh/objstorage/backends/rados.py b/swh/objstorage/backends/rados.py
deleted file mode 100644
--- a/swh/objstorage/backends/rados.py
+++ /dev/null
@@ -1,85 +0,0 @@
-# Copyright (C) 2018 The Software Heritage developers
-# See the AUTHORS file at the top-level directory of this distribution
-# License: GNU General Public License version 3, or any later version
-# See top-level LICENSE file for more information
-
-import rados
-
-from swh.model import hashutil
-from swh.objstorage import objstorage
-from swh.objstorage.exc import ObjNotFoundError
-
-READ_SIZE = 8192
-
-
-class RADOSObjStorage(objstorage.ObjStorage):
- """Object storage implemented with RADOS"""
-
- def __init__(self, *, rados_id, pool_name, ceph_config, allow_delete=False):
- super().__init__(allow_delete=allow_delete)
- self.pool_name = pool_name
- self.cluster = rados.Rados(conf=ceph_config, conffile="", rados_id=rados_id,)
- self.cluster.connect()
- self.__ioctx = None
-
- def check_config(self, *, check_write):
- if self.pool_name not in self.cluster.list_pools():
- raise ValueError("Pool %s does not exist" % self.pool_name)
-
- @staticmethod
- def _to_rados_obj_id(obj_id):
- """Convert to a RADOS object identifier"""
- return hashutil.hash_to_hex(obj_id)
-
- @property
- def ioctx(self):
- if not self.__ioctx:
- self.__ioctx = self.cluster.open_ioctx(self.pool_name)
- return self.__ioctx
-
- def __contains__(self, obj_id):
- try:
- self.ioctx.stat(self._to_rados_obj_id(obj_id))
- except rados.ObjectNotFound:
- return False
- else:
- return True
-
- def add(self, content, obj_id=None, check_presence=True):
- if not obj_id:
- raise ValueError("add needs an obj_id")
-
- _obj_id = self._to_rados_obj_id(obj_id)
-
- if check_presence:
- try:
- self.ioctx.stat(_obj_id)
- except rados.ObjectNotFound:
- pass
- else:
- return obj_id
- self.ioctx.write_full(_obj_id, content)
-
- return obj_id
-
- def get(self, obj_id):
- chunks = []
- _obj_id = self._to_rados_obj_id(obj_id)
- try:
- length, mtime = self.ioctx.stat(_obj_id)
- except rados.ObjectNotFound:
- raise ObjNotFoundError(obj_id) from None
- offset = 0
- while offset < length:
- chunk = self.ioctx.read(_obj_id, offset, READ_SIZE)
- chunks.append(chunk)
- offset += len(chunk)
-
- return b"".join(chunks)
-
- def check(self, obj_id):
- return True
-
- def delete(self, obj_id):
- super().delete(obj_id) # check delete permission
- return True
diff --git a/swh/objstorage/factory.py b/swh/objstorage/factory.py
--- a/swh/objstorage/factory.py
+++ b/swh/objstorage/factory.py
@@ -45,13 +45,6 @@
_STORAGE_CLASSES_MISSING["azure"] = e.args[0]
_STORAGE_CLASSES_MISSING["azure-prefixed"] = e.args[0]
-try:
- 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.backends.libcloud import (
AwsCloudObjStorage,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Nov 4 2024, 8:39 PM (20 w, 6 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3217856
Attached To
D6538: Remove the RADOS backend
Event Timeline
Log In to Comment