swh.objstorage.backends.rados module¶
-
class
swh.objstorage.backends.rados.
RADOSObjStorage
(*, rados_id, pool_name, ceph_config, allow_delete=False)[source]¶ Bases:
swh.objstorage.objstorage.ObjStorage
Object storage implemented with RADOS
-
check_config
(*, check_write)[source]¶ Check whether the object storage is properly configured.
- Parameters
check_write (bool) – if True, check if writes to the object storage
succeed. (can) –
- Returns
True if the configuration check worked, an exception if it didn’t.
-
property
ioctx
¶
-
add
(content, obj_id=None, check_presence=True)[source]¶ Add a new object to the object storage.
- Parameters
content (bytes) – object’s raw content to add in storage.
obj_id (bytes) – checksum of [bytes] using [ID_HASH_ALGO] algorithm. When given, obj_id will be trusted to match the bytes. If missing, obj_id will be computed on the fly.
check_presence (bool) – indicate if the presence of the content should be verified before adding the file.
- Returns
the id (bytes) of the object into the storage.
-
get
(obj_id)[source]¶ Retrieve the content of a given object.
- Parameters
obj_id (bytes) – object id.
- Returns
the content of the requested object as bytes.
- Raises
ObjNotFoundError – if the requested object is missing.
-
check
(obj_id)[source]¶ Perform an integrity check for a given object.
Verify that the file object is in place and that the content matches the object id.
- Parameters
obj_id (bytes) – object identifier.
- Raises
ObjNotFoundError – if the requested object is missing.
Error – if the request object is corrupted.
-
delete
(obj_id)[source]¶ Delete an object.
- Parameters
obj_id (bytes) – object identifier.
- Raises
ObjNotFoundError – if the requested object is missing.
-