lib
ProviderFactory
Factory class as a creator of multiple cloud destination. Each new implementation needs to be registered and added to Providers enum.
Source code in client/ayon_sitesync/providers/lib.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
get_provider(provider, project_name, site_name, tree=None, presets=None)
Returns new instance of provider client for specific site.
One provider could have multiple sites.
'tree' is used for injecting already created memory structure,
without it constructor of provider would need to calculate it
from scratch, which could be expensive.
Args: provider (string): 'gdrive','S3' site_name (string): descriptor of site, different service accounts must have different site name project_name (string): different projects could have diff. sites tree (dictionary): - folder paths to folder id structure presets (dictionary): config for provider and site (eg. "credentials_url"..) Returns: (implementation of AbstractProvider)
Source code in client/ayon_sitesync/providers/lib.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
get_provider_batch_limit(provider)
Each provider has some limit of files that could be processed in
one batch (loop step). It is not 'file' limit per se, but
calculation based on API queries for provider.
(For example 'gdrive' has 1000 queries for 100 sec, one file could
be multiple queries (one for each level of path + check if file
exists)
Args: provider (string): 'gdrive','S3' Returns:
Source code in client/ayon_sitesync/providers/lib.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
get_provider_cls(provider_code)
Returns class object for 'provider_code' to run class methods on.
Source code in client/ayon_sitesync/providers/lib.py
70 71 72 73 74 75 76 |
|
register_provider(provider, creator, batch_limit)
Provide all necessary information for one specific remote provider
Args: provider (string): name of provider creator (class): class implementing AbstractProvider batch_limit (int): number of files that could be processed in one loop (based on provider API quota) Returns: modifies self.providers and self.sites
Source code in client/ayon_sitesync/providers/lib.py
16 17 18 19 20 21 22 23 24 25 26 27 |
|