swh.objstorage.backends.winery.sharedbase module#

class swh.objstorage.backends.winery.sharedbase.ShardState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

STANDBY = 'standby'#
WRITING = 'writing'#
FULL = 'full'#
PACKING = 'packing'#
PACKED = 'packed'#
CLEANING = 'cleaning'#
READONLY = 'readonly'#
property locked#
property image_available#
property readonly#
class swh.objstorage.backends.winery.sharedbase.SignatureState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

INFLIGHT = 'inflight'#
PRESENT = 'present'#
DELETED = 'deleted'#
class swh.objstorage.backends.winery.sharedbase.SharedBase(**kwargs)[source]#

Bases: Database

uninit()[source]#
property lock#

Return an arbitrary unique number for pg_advisory_lock when creating tables

property database_tables#

Return the list of CREATE TABLE statements for all tables in the database

property locked_shard: str#
property locked_shard_id: int#
set_locked_shard() None[source]#
lock_one_shard(current_state: ShardState, new_state: ShardState, min_mapped_hosts: int = 0) Tuple[str, int] | None[source]#

Lock one shard in current_state, putting it into new_state. Only lock a shard if it has more than min_mapped_hosts hosts that have registered as having mapped the shard.

set_shard_state(new_state: ShardState, set_locker: bool = False, check_locker: bool = False, name: str | None = None, db: Connection | None = None)[source]#
create_shard(new_state: ShardState) Tuple[str, int][source]#
shard_packing_starts(name: str)[source]#
shard_packing_ends(name)[source]#
get_shard_info(id: int) Tuple[str, ShardState] | None[source]#
get_shard_state(name: str) ShardState | None[source]#
list_shards() Iterator[Tuple[str, ShardState]][source]#
count_objects(name: str | None = None) int | None[source]#
record_shard_mapped(host: str, name: str | None = None) Set[str][source]#
contains(obj_id) int | None[source]#
get(obj_id) Tuple[str, ShardState] | None[source]#
add_phase_1(obj_id) int | None[source]#
add_phase_2(obj_id)[source]#
delete(obj_id)[source]#
deleted_objects() Iterator[Tuple[bytes, str, ShardState]][source]#
clean_deleted_object(obj_id) None[source]#