synology_apm_repo.sdk.dedup.pool_descriptor module

PoolDescriptor: a picklable recipe for rebuilding one Pool fresh inside a worker process — the dedup-layer counterpart to storage.store_descriptor. Built from a live Pool (from_pool).

class synology_apm_repo.sdk.dedup.pool_descriptor.PoolDescriptor(store_descriptor, pool_root, vault_key, verify=VerifyPolicy(ciphertext_crc=False, fingerprint=False), limits=CacheLimits(bucket_readers=16, bucket_readers_interactive=64, chunks=4096, composition_records=64, composition_pages=128, saas_streams=8, dir_scan=256, dir_fixed=64, allocation_tables=256, forward_resolutions=4096))

Bases: object

Picklable recipe for rebuilding an equivalent Pool in a worker process (build_worker_pool).

store_descriptor: LocalFsStoreDescriptor | S3StoreDescriptor | AzureStoreDescriptor | SmbStoreDescriptor
pool_root: str
vault_key: bytes | None
verify: VerifyPolicy
limits: CacheLimits
classmethod from_pool(pool)

pool’s recipe, verify policy and cache limits included. None when its store can’t be reconstructed in a fresh process (an unrecognized store wrapper, or a backend built from an already-live client with no picklable recipe).

synology_apm_repo.sdk.dedup.pool_descriptor.build_worker_pool(descriptor)

Rebuilds a fresh ObjectStore/DirCache/Pool from descriptor; call it once per worker process, not per task, so the Pool’s caches persist across tasks (WorkerContext.init).

async synology_apm_repo.sdk.dedup.pool_descriptor.close_worker_store(store)

Best-effort release of a worker’s ObjectStore at shutdown: a close failure is swallowed, since a shutdown hook has nowhere to report it.

class synology_apm_repo.sdk.dedup.pool_descriptor.SupportsWorkerPool(*args, **kwargs)

Bases: Protocol

Content an export may decode in worker processes: it can describe the Pool a worker rebuilds to read it.

pool_descriptor()

How a worker rebuilds this content’s Pool, or None when it can’t be rebuilt in another process.

class synology_apm_repo.sdk.dedup.pool_descriptor.WorkerContext(store=None, pool=None)

Bases: object

One worker process’s ObjectStore/Pool pair, kept warm across its tasks: built once by init(), released once by shutdown(). Used by dedup.verify_bucket_check and dedup.export_workers.

Each entry point keeps its own top-level _*_worker_init/ _*_worker_shutdown pair (spawn pickles the initializer) that delegates the store/pool half here and adds any extra per-worker state.

Not frozen: init() assigns in place.

store: ObjectStore | None = None
pool: Pool | None = None
init(descriptor)
shutdown()
class synology_apm_repo.sdk.dedup.pool_descriptor.BoundProcessPool(pool_descriptor, *, initializer, initargs, max_workers=None)

Bases: AsyncClosing

Worker processes bound for their lifetime to one repository (pool_descriptor): their initializer builds that repository’s Pool once, and nothing re-initializes them per task. Async context manager; close() shuts them down.

Variables:
  • pool_descriptor – The repository the workers serve.

  • max_workers – How many worker processes there are, which is also how many tasks to keep in flight.

  • process_pool – The underlying executor, for concurrency.dispatch_to_pool.

accepts_pool(pool_descriptor)

Whether work on pool_descriptor’s repository may run here.

async close()

Shuts the workers down, waiting for in-flight tasks (off the event loop).