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
- 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
- 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]#
- get_shard_state(name: str) → ShardState | None[source]#