-
Notifications
You must be signed in to change notification settings - Fork 18
Support large addons via sparse checkout of cache #329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,6 +81,8 @@ class AddonCatalogEntry: | |
| branch_display_name: Optional[str] = None | ||
| metadata: Optional[CatalogEntryMetadata] = None # Generated by the cache system | ||
| last_update_time: str = "" # Generated by the cache system | ||
| curated: bool = True # Generated by the cache system | ||
| sparse_cache: bool = False # Generated by the cache system | ||
| relative_cache_path: str = "" # Generated by the cache system | ||
|
|
||
| def __init__(self, raw_data: Dict[str, str]) -> None: | ||
|
|
@@ -135,7 +137,16 @@ def instantiate_addon(self, addon_id: str) -> Addon: | |
| state = Addon.Status.UNCHECKED | ||
| else: | ||
| state = Addon.Status.NOT_INSTALLED | ||
| url = self.repository if self.repository else self.zip_url | ||
| if self.sparse_cache: | ||
| if self.zip_url: | ||
| url = self.zip_url | ||
| else: | ||
| # TODO: Try to generate the expected URL form based on the repo location | ||
| raise RuntimeError(f"Sparse cache entry {addon_id} has no zip_url") | ||
|
Comment on lines
+140
to
+145
|
||
| elif self.repository: | ||
| url = self.repository | ||
| else: | ||
| url = self.zip_url | ||
| if self.git_ref: | ||
| addon = Addon(addon_id, url, state, branch=self.git_ref) | ||
| else: | ||
|
|
@@ -181,6 +192,8 @@ def instantiate_addon(self, addon_id: str) -> Addon: | |
| self.branch_display_name if self.branch_display_name else self.git_ref | ||
| ) | ||
|
|
||
| addon.curated = self.curated | ||
|
|
||
| return addon | ||
|
|
||
| @staticmethod | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -54,8 +54,8 @@ | |||||||||||||||||
| "branch_display_name": { | ||||||||||||||||||
| "type": "string" | ||||||||||||||||||
| }, | ||||||||||||||||||
| "last_update_time": { | ||||||||||||||||||
| "type": "string" | ||||||||||||||||||
| "curated": { | ||||||||||||||||||
| "type": "boolean" | ||||||||||||||||||
|
||||||||||||||||||
| "type": "boolean" | |
| "type": "boolean" | |
| }, | |
| "last_update_time": { | |
| "description": "Generated by the cache system: timestamp of the last update for this catalog entry." | |
| }, | |
| "sparse_cache": { | |
| "description": "Generated by the cache system: auxiliary cache data associated with this catalog entry." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TODO comment suggests generating an expected URL from the repo location when zip_url is missing. However, the code raises a RuntimeError instead. If this fallback behavior is intended, it should be implemented now rather than raising an error. If sparse cache entries are guaranteed to have a zip_url by the server-side cache generation (as suggested by the PR description), then this TODO and the error handling may be unnecessary. Consider either: (1) implementing the URL generation logic now, (2) removing the TODO if the server guarantees zip_url will always be present, or (3) clarifying in the error message that this is a server-side configuration issue.