swh.objstorage.backends.winery.pools package#

Submodules:

Module contents:

class swh.objstorage.backends.winery.pools.ImageReader(*args, **kwargs)[source]#

Bases: Protocol

Protocol for images’ reader classes. This allows a pool to pick a class depending on the backing file format (currently swh.shard.Shard or swh.mosaic.MosaicReader)

lookup(key: bytes) bytes | None[source]#
close() None[source]#
class swh.objstorage.backends.winery.pools.ImageWriter(*args, **kwargs)[source]#

Bases: Protocol

Protocol for images’ writer classes. This allows a pool to pick a class depending on the backing file format (currently swh.shard.ShardCreator or swh.mosaic.MosaicWriter).

write(key: bytes, object: bytes) None[source]#
class swh.objstorage.backends.winery.pools.Pool(*args, **kwargs)[source]#

Bases: Protocol

pool_name: str#
image_exists(image: str) bool[source]#

Check whether the named image exists (it does not have to be mapped)

image_mapped(image: str) Literal['ro', 'rw'] | None[source]#

Check whether the image is already mapped, read-only or read-write

image_list() List[str][source]#

List all known images, mapped or not

image_path(image: str) str[source]#

Return a path to the image, that can be opened with open().

image_create(image: str) None[source]#

Create a new image named image and allocate the right amount of space.

image_map(image: str, options: str) None[source]#

Map an image for use. Options can be “ro” to map the image read-only, or “rw” to map the image read-write.

image_unmap(image: str) None[source]#

Unmap the image. Once this is done, the image is unavailable for use.

image_remap_ro(image: str)[source]#
image_import(image: str) None[source]#

Import an existing image file in the current pool

image_open(image: str) ImageReader[source]#
delete_object(shard_name: str, obj_id: bytes) None[source]#
open_writer(shard_name: str, nb_objects: int, xcreate_image: bool) ImageWriter[source]#

Instantiate the correct ImageWriter object for the given shard

This is used at time of packing a batch of objects in a shard file.

class swh.objstorage.backends.winery.pools.FileBackedPool(base_directory: Path, pool_name: str, shard_max_size: int)[source]#

Bases: Pool

File-backed pool for Winery shards mimicking a Ceph RBD pool.

Unmapped images are represented by setting the file permission to 0o000.

image_exists(image: str) bool[source]#

Check whether the named image exists (it does not have to be mapped)

image_list() List[str][source]#

List all known images, mapped or not

image_path(image: str) str[source]#

Return a path to the image, that can be opened with open().

image_create(image: str) None[source]#

Create a new image named image and allocate the right amount of space.

image_map(image: str, options: str) None[source]#

Map an image for use. Options can be “ro” to map the image read-only, or “rw” to map the image read-write.

image_unmap(image: str) None[source]#

Unmap the image. Once this is done, the image is unavailable for use.

image_unmap_all() None[source]#
image_import(image: str) None[source]#

Import an existing image file in the current pool

swh.objstorage.backends.winery.pools.pool_from_settings(shards_settings: Shards, shards_pool_settings: ShardsPool) Pool[source]#

Return a Pool from the settings