Extension Manager:Sqlite Storage: Difference between revisions

no edit summary
No edit summary
 
Line 21: Line 21:
* Downloads (Used to display download progress in the UI)
* Downloads (Used to display download progress in the UI)


The UI uses a template to display items, however it does not use the real extensions.rdf datasource. Instead a dynamic datasource is provided that calculates values for certain attributes:
The UI uses a template to display items, however it does not use the real <code>extensions.rdf</code> datasource. Instead a dynamic datasource is provided that calculates values for certain attributes:


* Add-on metadata
* Add-on metadata
Line 77: Line 77:
There are some key points suggested in this design.
There are some key points suggested in this design.


The addon table contains all known add-ons in all install locations. This is different from the current situation where we only cache data for the add-ons in the install location with the highest priority. This makes various future behaviours possible including using the newest version of an add-on regardless of installLocation, using any of the same add-on based on compatibility/blocklisting etc. We can create a view in the database that returns only the currently active add-ons for the common query cases.
The <code>addon</code> table contains all known add-ons in all install locations. This is different from the current situation where we only cache data for the add-ons in the install location with the highest priority. This makes various future behaviours possible including using the newest version of an add-on regardless of install location, using any of the same add-on based on compatibility/blocklisting etc. We can create a view in the database that returns only the currently active add-ons for the common query cases.


The target_application table is linked to add-ons by addon id and version rather than being a foreign key into the addon table. Since an add-on might be installed with the same version in different installLocations there is no need to duplicate the compatibility information (which should be the same) in the database. Likewise known updates have their targetApplication info here. We could potentially think about caching this information almost permanently such that future installs of a previously installed add-on may not need another compatibility update check.
The <code>target_application</code> data is linked to add-ons by addon id and version rather than being a foreign key into the <code>addon</code> table. Since an add-on might be installed with the same version in different install locations there is no need to duplicate the compatibility information (which should be the same) in the database. Likewise known updates have their target application info here. We could potentially think about caching this information almost permanently such that future installs of a previously installed add-on may not need another compatibility update check.


Note the local_strings table. This is used for the contributors, localizers and other multi-string localized metadata. The type column will be an enumeration of the different types.
Note the <code>locale_strings</code> table. This is used for the contributors, localizers and other multi-string localized metadata. The type column will be an enumeration of the different types.


''Might want to do the same for the requirements, however right now they come only out of the install.rdf and are never updated by remote data.''
''Might want to do the same for the requirements, however right now they come only out of the install.rdf and are never updated by remote data.''


''Do we actually need to keep all the targetApplication data? We do currently but all we need for compatibility checks is minVersion and maxVersion and the app (toolkit/firefox). I'm generally in favour of keeping as much data but querying compatibility would be much simpler with the min/maxversion in the addon table''
''Do we actually need to keep all the target application data? We do currently but all we need for compatibility checks is minVersion and maxVersion and the app (toolkit/firefox). I'm generally in favour of keeping as much data but querying compatibility would be much simpler with the min/maxversion in the addon table''


==UI==
==UI==


Currently the UI is purely template based which has meant that plugin and add-on search results have ended up being put into in-memory rdf datasources. Switching away from templates will allow us to break this into a more straightforward approach. We just have one richlistbox per pane in a deck, on startup we create richlistitems for every installed add-on, plugin and search results when available.
Currently the UI is purely template based which has meant that plugin and add-on search results have ended up being put into in-memory rdf datasources. Switching away from templates will allow us to break this into a more straightforward approach. We just have one <code>richlistbox</code> per pane in a deck, on window startup we create <code>richlistitems</code> for every installed add-on, plugin and search results when available.


For the install and add-on lists we will have to have some kind of notification from the EM backend to the UI to let it know that a change has been made that might require updating the UI.
For the install and add-on lists we will have to have some kind of notifications from the EM backend to the UI to let it know that a change has been made that might require updating the UI.


For installs the already present <code>nsIAddonInstallListener</code> interface will be used. There will be some cleaning up so it gets passed the same <code>nsIAddonDownload</code> object for every single call.
For installs the already present <code>nsIAddonInstallListener</code> interface will be used. There will be some cleaning up so it gets passed the same <code>nsIAddonDownload</code> object for every single call.
Line 99: Line 99:
==API==
==API==


Interface changes are necessary so that the UI can query for all of the necessary information. The main changes are to nsIExtensionManager and nsIUpdateItem (renamed to nsIAddon).
Interface changes are necessary so that the UI can query for all of the necessary information. The main changes are to <code>nsIExtensionManager</code> and <code>nsIUpdateItem</code> (renamed to <code>nsIAddon</code>).


[[Extension Manager:Sqlite Storage:nsIExtensionManager]]
[[Extension Manager:Sqlite Storage:nsIExtensionManager]]
Line 105: Line 105:
[[Extension Manager:Sqlite Storage:nsIAddon]]
[[Extension Manager:Sqlite Storage:nsIAddon]]


Installed items would be initialised from the addon table in the database. This gives enough information for internal operations. Accesses to other properties like the localised information will cause additional db queries to find them.
Installed items would be initialised from the <code>addon</code> table in the database. This gives enough information for internal operations. Accesses to other properties like the localised information will cause additional db queries to find them.


For a pending install/downloading add-on the nsIAddon interface is mostly unfilled, things like the version are unavailable until after the download is complete and the install.rdf read. If they are updates then the id and name and some other information can be prefilled from the original item. This would enable us to reject updates that turn out to not be the id and version expected.
For a pending install/downloading add-on the <code>nsIAddon</code> interface is mostly unfilled, things like the version are unavailable until after the download is complete and the install.rdf read. If they are updates then the id and name and some other information can be prefilled from the original item. This would enable us to reject updates that turn out to not be the id and version expected.


''We could consider moving the add-on operations (uninstall, disable, enable etc.) onto the nsIAddon interface.''
''We could consider moving the add-on operations (uninstall, disable, enable etc.) onto the nsIAddon interface.''
Line 119: Line 119:
This is not massively different to the current situation except that previously items in the install cache had to be added to the container in the database to allow the UI to function correctly.
This is not massively different to the current situation except that previously items in the install cache had to be added to the container in the database to allow the UI to function correctly.


The methods for retrieving addons on nsIExtensionManager pulls items from one or other of the database and install cache. <code>getPendingInstalls</code>, <code>getAvailableUpdates</code> both retrieve from the install cache. <code>getItemList</code> and <code>getItemForID</code> retrieve from the database.
The methods for retrieving addons on <code>nsIExtensionManager</code> pulls items from one or other of the database and install cache. <code>getPendingInstalls</code>, <code>getAvailableUpdates</code> both retrieve from the install cache. <code>getItemList</code> and <code>getItemForID</code> retrieve from the database.


The install cache is initially empty at every startup. When first queried it adds mirrored copies of all the available updates in the database. The installation methods create new items in the install cache. Update checks create new items in the database and a mirror of the same item in the install cache. Items remain in the install cache until shutdown.
The install cache is initially empty at every startup. When first queried it adds mirrored copies of all the available updates in the database. The installation methods create new items in the install cache. Update checks create new items in the database and a mirror of the same item in the install cache. Items remain in the install cache until shutdown.
canmove, Confirmed users
1,570

edits