swh.objstorage.factory module#

swh.objstorage.factory.get_objstorage(cls: str, **kwargs) ObjStorageInterface[source]#

Create an ObjStorage using the given implementation class.

  • cls – objstorage class unique key contained in the _STORAGE_CLASSES dict.

  • kwargs – arguments for the required class of objstorage that must match exactly the one in the __init__ method of the class.


subclass of ObjStorage that match the given storage_class argument.


ValueError – if the given storage class is not a valid objstorage key.

class swh.objstorage.factory.ObjStorage(*, allow_delete=False, **kwargs)[source]#

Bases: object

add_batch(contents: Union[Mapping[bytes, bytes], Iterable[Tuple[Union[bytes, CompositeObjId], bytes]]], check_presence: bool = True) Dict[source]#
restore(content: bytes, obj_id: Union[bytes, CompositeObjId]) None[source]#
get_batch(obj_ids: Iterable[Union[bytes, CompositeObjId]]) Iterator[Optional[bytes]][source]#
abstract delete(obj_id: Union[bytes, CompositeObjId])[source]#
list_content(last_obj_id: Optional[Union[bytes, CompositeObjId]] = None, limit: Optional[int] = 10000) Iterator[CompositeObjId][source]#
download_url(obj_id: Union[bytes, CompositeObjId], content_disposition: Optional[str] = None, expiry: Optional[timedelta] = None) Optional[str][source]#