CloudServices/Sync/FxSync/Developer/ClientAPI: Difference between revisions

→‎Writing a Store class: Fixed wrong names of getAllIDs and changeItemID methods
(→‎Writing a Record class: Property is called _logName, not _logname)
(→‎Writing a Store class: Fixed wrong names of getAllIDs and changeItemID methods)
Line 73: Line 73:
*<tt>itemExists(id)</tt>
*<tt>itemExists(id)</tt>
*<tt>createRecord(id, uri)</tt>
*<tt>createRecord(id, uri)</tt>
*<tt>changeItemId(oldId, newId)</tt>
*<tt>changeItemID(oldId, newId)</tt>
*<tt>getAllIds()</tt>
*<tt>getAllIDs()</tt>
*<tt>wipe()</tt>
*<tt>wipe()</tt>
*<tt>create(record)</tt>
*<tt>create(record)</tt>
Line 92: Line 92:
Should simply return <tt>true</tt> if an item with the given guid exists in the store, <tt>false</tt> otherwise.
Should simply return <tt>true</tt> if an item with the given guid exists in the store, <tt>false</tt> otherwise.


=== changeItemId(oldId, newId) ===
=== changeItemID(oldId, newId) ===


Must find the stored item currently associated with the guid <tt>oldId</tt> and change it to be associated with the guid <tt>newId</tt>.
Must find the stored item currently associated with the guid <tt>oldId</tt> and change it to be associated with the guid <tt>newId</tt>.


=== getAllIds() ===
=== getAllIDs() ===


Must return an iterable list containing the GUIDs of every item being stored on the local system.  This can be a dictionary-type object where the keys are the GUIDs and the values are whatever; or it can simply be a list of GUIDs.
Must return an iterable list containing the GUIDs of every item being stored on the local system.  This can be a dictionary-type object where the keys are the GUIDs and the values are whatever; or it can simply be a list of GUIDs.
Line 141: Line 141:
     return record;
     return record;
   },
   },
   changeItemId: function(oldId, newId) {
   changeItemID: function(oldId, newId) {
     // Find the item with guid = oldId and change its guid to newId.
     // Find the item with guid = oldId and change its guid to newId.
   },
   },
   getAllIds: function() {
   getAllIDs: function() {
     // Return a list of the GUIDs of all items.  Invent GUIDs for any items
     // Return a list of the GUIDs of all items.  Invent GUIDs for any items
     // that don't have them already, and remember the mapping for later use.
     // that don't have them already, and remember the mapping for later use.