AliasResolver
Index
Methods
__aenter__
Context manager to prevent race condition in alias creation.
Returns AliasResolver
__aexit__
Parameters
exc_type: type[BaseException] | None
exc_value: BaseException | None
exc_traceback: TracebackType | None
Returns None
__init__
Parameters
storage_type: type[(Dataset | KeyValueStore) | RequestQueue]
alias: str
configuration: Configuration
Returns None
resolve_id
Get id of the aliased storage.
Either locate the id in the in-memory mapping or create the new storage.
Returns str | None
store_mapping
Add alias and related storage id to the mapping in default kvs and local in-memory mapping.
Parameters
storage_id: str
Returns None
Class for handling aliases.
The purpose of this is class is to ensure that alias storages are created with correct id. This is achieved by using default kvs as a storage for global mapping of aliases to storage ids. Same mapping is also kept in memory to avoid unnecessary calls to API and also have limited support of alias storages when not running on Apify platform. When on Apify platform, the storages created with alias are accessible by the same alias even after migration or reboot.