Changes

Jump to: navigation, search

Services/Sync/Features/Addon Sync

392 bytes added, 22:53, 30 August 2011
pseudocode work
The AddonManager will support the following APIs:
; 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. This API technically isn't required, but it makes the Add-on engine's createRecord(syncGUID) API much simpler. Without it, Sync code would probably query for all add-ons and iterate until it finds a match. By pushing the logic to AddonManager, optimization can be done there, if needed.
; applySyncDataRecords(records, callbackObj) : This applies an array of records that contain add-on metadata and makes the current state of the world agree with that data as much as possible.
The implementation of applySyncDataRecords() will resemble the following pseudocode:
<pre>foreach record in records: if record.isDeleted: found = this.getAddonBySyncGUID(record.syncGUID) if found: this.deleteAddon(found) # else nothing to do since record not found
callbackObj.onSuccess(record) continue
existing = this.getExistingAddonBySyncData(record.syncData) result = null if existing: result = existing.mergeupdateFromSyncData(record.syncData) else: result = this.installAddonFromSyncData(syncGUID, syncData)
// call result ? callbackObj.onSuccess on (record) : callbackObj.onFailure depending on result of above(record)
callbackObj.onFinished()</pre>
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