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, named to match it (both are “a picklable descriptor + a worker-side rebuild factory for X”). Neither module depends on the other’s caller; this one only needs a StoreDescriptor already in hand, from whichever DedupRepo/Pool a caller is dispatching work for — verify_reachable.py has a DedupRepo (from_repo), export_scheduler.py only ever has a bare Pool (from_pool), since a DedupFile/ByteRangeView exposes its own .pool, never a whole DedupRepo.

class synology_apm_repo.sdk.dedup.pool_descriptor.PoolDescriptor(store_descriptor, pool_root, vault_key, verify_fingerprint=False, verify_ciphertext_crc=False)

Bases: object

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

store_descriptor: LocalFsStoreDescriptor | S3StoreDescriptor | AzureStoreDescriptor | SmbStoreDescriptor
pool_root: str
vault_key: bytes | None
verify_fingerprint: bool = False
verify_ciphertext_crc: bool = False
classmethod from_repo(repo, *, verify_fingerprint=False, verify_ciphertext_crc=False)

None when repo.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) — the one place a caller assembles the other four fields alongside that probe, instead of each repeating the same “call describe_store, check None, then assemble” sequence inline.

classmethod from_pool(pool)

Same None-on-undescribable-store contract as from_repo, for a caller (export_scheduler.py) that only ever has a bare, already-configured Pool in hand, never a whole DedupRepo to build a fresh one from — so, unlike from_repo, this mirrors pool’s own current verify_fingerprint/verify_ciphertext_crc settings rather than taking an explicit override for either: a worker rebuilding this pool should behave identically to it, not silently reset either flag.

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

Rebuilds a fresh ObjectStore/DirCache/Pool from descriptor — called once per worker process (from a ProcessPoolExecutor’s synchronous initializer=, safe since every real backend’s constructor is synchronous and does no I/O), never once per task: the resulting Pool’s own caches (bucket readers, and — when verify_fingerprint — its AllocationTableCache) are only worth anything if they persist across every task that worker ever runs.

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

The natural counterpart to build_worker_pool() above: best-effort release of a worker’s own ObjectStore at shutdown — its aiohttp connector, for S3Store/AzureStore; a no-op for LocalFsStore/SmbStore, or None (nothing was ever built). A second, separate isinstance(store, AsyncCloseable) check rather than a call to storage.base.aclose_if_possible (the one every other caller — api/session.py’s Session.close(), storage/recording.py’s _InstrumentedStore.aclose() — shares): that helper propagates a close failure, but a worker’s own shutdown hook (_export_worker_shutdown/_verify_worker_shutdown) has nothing left to report a failure to, so this one swallows it instead.