synology_apm_repo.sdk.storage.store_descriptor module¶
Picklable stand-ins for a live ObjectStore, so a worker process
spawned by concurrency.new_process_pool() can rebuild an equivalent
store instead of receiving one directly — an already-open S3Store/
AzureStore/SmbStore holds a live client bound to the parent’s own
event loop and can’t cross a process boundary at all.
describe_store() is the one place this module reaches into another
storage/ class’s private fields (_bucket/_client_kwargs/…) —
an accepted, deliberately narrow exception to those classes’ own
encapsulation, the same way dedup/chunk_walk.py is the one module
allowed to reach into DedupFile._extents() for its own narrow,
single purpose rather than that field becoming generally public: every
field read here is read only to describe how to rebuild an equivalent
store, never touched for any other purpose,
and the reason a free function does this instead of each store class
exposing a public describe() method is that ObjectStore itself
stays a narrow four-method Protocol (read/size/exists/
listdir) — a test fake, or a future backend, should never be required
to also implement multiprocess-support machinery just to satisfy that
Protocol.
- class synology_apm_repo.sdk.storage.store_descriptor.LocalFsStoreDescriptor(root)¶
Bases:
objectPicklable recipe for rebuilding an equivalent
LocalFsStore.
- class synology_apm_repo.sdk.storage.store_descriptor.S3StoreDescriptor(bucket, client_kwargs)¶
Bases:
objectPicklable recipe for rebuilding an equivalent
S3Store.
- class synology_apm_repo.sdk.storage.store_descriptor.AzureStoreDescriptor(container, client_kwargs)¶
Bases:
objectPicklable recipe for rebuilding an equivalent
AzureStore.
- class synology_apm_repo.sdk.storage.store_descriptor.SmbStoreDescriptor(share, server, port, username, password)¶
Bases:
objectPicklable recipe for rebuilding an equivalent
SmbStore.
- synology_apm_repo.sdk.storage.store_descriptor.describe_store(store)¶
storereduced to a picklable recipe for rebuilding an equivalent one elsewhere, orNonewhen that’s not possible — always a graceful “can’t”, never a raised error, since every caller treatsNoneas “fall back to today’s single-process path” rather than a failure:A
TracingStore/RecordingStorewrapper (storage/recording.py) or any other/unrecognizedObjectStoreimplementation — this module only knows the four real backends by name, deliberately, not an oversight.An
S3Store/AzureStorebuilt from an already-live, injectedclient=(tests, or a caller-supplied pre-entered client) — there is no picklable recipe for a client that already exists.
- synology_apm_repo.sdk.storage.store_descriptor.rebuild_store(descriptor)¶
The worker-process-side counterpart to
describe_store()— every real backend’s constructor is synchronous and does no I/O (confirmed for all four:LocalFsStore.__init__’sos.open/Path.is_dir(),S3Store/SmbStore’s constructors likewise do no I/O, andAzureStore’sBlobServiceClient(...)call is plain client-object configuration), so this is always safe to call from aProcessPoolExecutor’s synchronousinitializer=, not just from inside a worker’s own event loop.