swh.objstorage.factory module#
- swh.objstorage.factory.get_objstorage(cls: str, **kwargs) ObjStorageInterface [source]#
Create an ObjStorage using the given implementation class.
- Parameters:
cls – objstorage class unique key contained in the OBJSTORAGE_IMPLEMENTATIONS dict.
kwargs – arguments for the required class of objstorage that must match exactly the one in the __init__ method of the class.
- Returns:
subclass of ObjStorage that match the given storage_class argument.
- Raises:
ValueError – if the given storage class is not a valid objstorage key.
- class swh.objstorage.factory.ObjStorage(*, allow_delete: bool = False, **kwargs)[source]#
Bases:
object
- name: str = 'objstorage'#
Default objstorage name; can be overloaded at instantiation time giving a ‘name’ argument to the constructor
- add_batch(contents: Mapping[bytes, bytes] | Iterable[Tuple[bytes | CompositeObjId, bytes]], check_presence: bool = True) Dict [source]#
- abstract delete(obj_id: bytes | CompositeObjId)[source]#
- list_content(last_obj_id: bytes | CompositeObjId | None = None, limit: int | None = 10000) Iterator[CompositeObjId] [source]#
- download_url(obj_id: bytes | CompositeObjId, content_disposition: str | None = None, expiry: timedelta | None = None) str | None [source]#
- abstract get(obj_id: bytes | CompositeObjId) bytes [source]#
- check(obj_id: bytes | CompositeObjId) None [source]#
Check if a content is found and recompute its hash to check integrity.