@@ -40,6 +40,17 @@ def __init__(self, storage_type: _StorageT, alias: str, token: str, api_url: str
40
40
41
41
@classmethod
42
42
def get_additional_cache_key (cls , api_url : str , token : str , * , encrypted : bool = False ) -> str :
43
+ """Return additional cache key.
44
+
45
+ Args:
46
+ api_url: Api url used to open the storage.
47
+ token: Token used to open the storage.
48
+ encrypted: Whether the token should be encrypted in the cache key.
49
+
50
+ Returns:
51
+ Serialized additional cache key string.
52
+
53
+ """
43
54
if not encrypted :
44
55
return cls .ADDITIONAL_CACHE_KEY_SEPARATOR .join ([api_url , token ])
45
56
@@ -51,10 +62,12 @@ def get_additional_cache_key(cls, api_url: str, token: str, *, encrypted: bool =
51
62
52
63
@property
53
64
def additional_cache_key (self ) -> str :
65
+ """Serialized unencrypted additional cache key string."""
54
66
return self .get_additional_cache_key (self .api_url , self .token , encrypted = False )
55
67
56
68
@classmethod
57
69
def from_exported_string (cls , alias_as_string : str ) -> _Alias :
70
+ """Create _Alias from previously serialized _Alias."""
58
71
storage_map : dict [str , _StorageT ] = {
59
72
'Dataset' : Dataset ,
60
73
'KeyValueStore' : KeyValueStore ,
@@ -90,6 +103,7 @@ def _create_fernet(token: str) -> Fernet:
90
103
return Fernet (base64 .urlsafe_b64encode (token_32 ))
91
104
92
105
async def store_mapping_to_apify_kvs (self , storage_id : str ) -> None :
106
+ """Add _Alias and related storage id to the mapping in default kvs."""
93
107
if not Configuration .get_global_configuration ().is_at_home :
94
108
logging .getLogger (__name__ ).warning (
95
109
'Alias storage limited retention is only supported on Apify platform. Storage is not exported.'
0 commit comments