Changeset View
Changeset View
Standalone View
Standalone View
swh/objstorage/cloud/objstorage_azure.py
Show First 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | class AzureCloudObjStorage(ObjStorage): | ||||
def check(self, obj_id): | def check(self, obj_id): | ||||
"""Check the content integrity. | """Check the content integrity. | ||||
""" | """ | ||||
obj_content = self.get(obj_id) | obj_content = self.get(obj_id) | ||||
content_obj_id = compute_hash(obj_content) | content_obj_id = compute_hash(obj_content) | ||||
if content_obj_id != obj_id: | if content_obj_id != obj_id: | ||||
raise Error(obj_id) | raise Error(obj_id) | ||||
def delete(self, obj_id): | |||||
"""Delete an object.""" | |||||
hex_obj_id = self._internal_id(obj_id) | |||||
try: | |||||
self.block_blob_service.delete_blob( | |||||
container_name=self.container_name, | |||||
blob_name=hex_obj_id) | |||||
except AzureMissingResourceHttpError: | |||||
raise ObjNotFoundError('Content {} not found!'.format(hex_obj_id)) | |||||
return True |