swh.objstorage.backends.winery package#
Subpackages#
Submodules#
- swh.objstorage.backends.winery.database module
- swh.objstorage.backends.winery.gunicorn module
- swh.objstorage.backends.winery.objstorage module
- swh.objstorage.backends.winery.roshard module
- swh.objstorage.backends.winery.rwshard module
- swh.objstorage.backends.winery.settings module
- swh.objstorage.backends.winery.sharedbase module
ShardState
SignatureState
TemporaryShardLocker
SharedBase
SharedBase.current_version
SharedBase.locked_shard
SharedBase.locked_shard_id
SharedBase.set_locked_shard()
SharedBase.lock_one_shard()
SharedBase.maybe_lock_one_shard()
SharedBase.set_shard_state()
SharedBase.create_shard()
SharedBase.shard_packing_starts()
SharedBase.shard_packing_ends()
SharedBase.get_shard_info()
SharedBase.get_shard_state()
SharedBase.list_shards()
SharedBase.count_objects()
SharedBase.record_shard_mapped()
SharedBase.contains()
SharedBase.get()
SharedBase.record_new_obj_id()
SharedBase.list_signatures()
SharedBase.delete()
SharedBase.deleted_objects()
SharedBase.clean_deleted_object()
- swh.objstorage.backends.winery.sleep module
- swh.objstorage.backends.winery.throttler module
Module contents#
- class swh.objstorage.backends.winery.WineryObjStorage(database: Database, shards: Shards, shards_pool: ShardsPool, throttler: Throttler, packer: Packer | None = None, readonly: bool = False, allow_delete: bool = False, name: str = 'winery')[source]#
Bases:
ObjStorage
- PRIMARY_HASH: LiteralPrimaryHash = 'sha256'#
- name: str = 'winery'#
Default objstorage name; can be overloaded at instantiation time giving a ‘name’ argument to the constructor
- get(obj_id: ObjId) bytes [source]#
Retrieve the content of a given object.
- Parameters:
obj_id – object id.
- Returns:
the content of the requested object as bytes.
- Raises:
ObjNotFoundError – if the requested object is missing.
- check_config(*, check_write: bool) bool [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, False if ‘check_write’ is True and the object storage is actually read only, and an exception if the check failed.
- add(content: bytes, obj_id: ObjId, check_presence: bool = True) None [source]#
Add a new object to the object storage.
- Parameters:
content – object’s raw content to add in storage.
obj_id – either dict of checksums, or single checksum of [bytes] using [ID_HASH_ALGO] algorithm. It is trusted to match the bytes.
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.
- delete(obj_id: ObjId)[source]#
Delete an object.
- Parameters:
obj_id – object identifier.
- Raises:
ObjNotFoundError – if the requested object is missing.
- list_content(last_obj_id: ObjId | None = None, limit: int | None = 10000) Iterator[ObjId] [source]#
Generates known object ids.
- Parameters:
last_obj_id – object id from which to iterate from (excluded).
limit (int) – max number of object ids to generate. If unset (None), generate all objects (behavior might not be guaranteed for all backends).
- Generates:
obj_id: object ids.