Changes

Jump to: navigation, search

Services/Sync/Features/Addon Sync

86 bytes removed, 22:47, 30 August 2011
rewrite addonmanager api changes
For add-on objects, providers wishing to opt in to Sync will expose the following read-only, optional properties:
; syncData : a string that describes data necessary to synchronize the add-on between clients. The format of the string is not defined, and is opaque to Sync code. A From the perspective of add-on providers, it should be a JSON representation of an object might be with a good choice, *type* field that is used to route it to hold the data needed by the add-ons manager to install/uninstall an addonproper provider.
; syncGUID : a GUID used to identify this add-on across Sync client instances. The GUID should be generated using Utils.makeGUID() from the Sync code. It is basically a Base64-encoded representation of 9 random bytes.
; getAddonBySyncGUID(syncGUID, callback) : Obtain an add-on from its Sync GUID. Calls the supplied function when that add-on is retrieved. The callback receives null on unknown add-on or the add-on object (generated from the underlying provider) on success.
; installOrUpdateAddonFromSyncDataapplySyncDataRecords(syncData, syncGUIDrecords, callbackObj) : Installs This applies an array of records that contain add-on from sync data or updates metadata and makes the add-on so it has the information specified. Receives the data from current state of the original add-on, the GUID it should be installed world agree with, and an object describing callbacks to be invoked when specific events occurs. The manager will try to obtain an install record and then execute the install. The callbackObj contains the optional keys *onFailure*, *onInstall*, and *onNewSyncGUID* which can be functions that are called when those events occur. Each function receives *syncData* and *syncGUID* data as their first arguments. *onInstall* will additionally receive the newly-created (or existing) add-on record and a boolean indicating whether a restart is required. *onNewSyncGUID* will receive much as a 3rd parameter the new syncGUID for the already-installed add-on. As inferred from the callback definition, the function must be able to detect existing add-ons from the *syncData* and update the *syncGUID* of that add-on to the value specifiedpossible.
; uninstallAddonBySyncGUID(syncGUID, The callbackObj) : Uninstalls is an add-on specified by its syncGUID. The callbackObj has object containing the following optional keys *onSuccess* and *onFailure*. Each receives as an argument the passed *syncGUID*. :
Both of these APIs will require *onSuccess - Invoked when an individual record is processed successfully. Arguments are the record itself.*onFailure - Invoked when an individual record could not be processed successfully. Arguments are the AddonManager to record itself.*onFinished - Invoked when all records have finished processing. Each record is an additional relationship with object containing the following keys: * syncGUID (required) - The Sync GUID for this record* syncData (optional) - The .syncData field from an add-on providers * isDeleted (via APIsoptional)- If evaluates to true, indicates that the record was deleted. The providers will need Application of this record should involve trying to provide a routine to install delete this add-ons from *on if present or no-op if not present. The implementation of applySyncDataRecords() will resemble the following pseudocode:  foreach record in records: if record.isDeleted: found = this.getAddonBySyncGUID(record.syncGUID) if found: this.deleteAddon(found) callbackObj.onSuccess(record) continue  existing = this.getExistingAddonBySyncData(record.syncData) if existing: existing.merge(record.syncData* instances) else: this. AndinstallAddonFromSyncData(syncGUID, the AddonManager will need to know how to syncData)  // call into theseonSuccess on onFailure depending on result of above  callbackObj.onFinished()
The add-ons Sync engine will discover the set of add-ons that can be synced via the following procedure:
Canmove, confirm
409
edits

Navigation menu