Closed Bug 499871 Opened 15 years ago Closed 15 years ago

Simple storage improvements

Categories

(Mozilla Labs :: Jetpack Prototype, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: aza, Assigned: adw)

References

Details

Attachments

(2 files, 5 obsolete files)

As Myk suggests in his post <http://groups.google.com/group/mozilla-labs-jetpack/browse_thread/thread/8813c5da5b135bf3> adding a |has| and |list| commands to storage.simple would be excellent additions.

First, |has| and |list| should be added to JEP 11 <https://wiki.mozilla.org/Labs/Jetpack/JEP/11> and then added to the actual API. Finally, the documentation should be updated.
Priority: -- → P1
Target Milestone: -- → 0.3
Attached patch WIP v1 (obsolete) — Splinter Review
Lots of changes.  Since the code is fairly small and changes in this bug and bug 499872 overlap, this patch covers both bugs (plus some).

This patch adds the following methods:

clear
forEachItem
forEachKey
forEachValue
has
size

Nearly every method can be called multiple ways, e.g., to act on a single key or value, a set of keys, or all items.  They're documented, so have a look.

Needs a little more polish.
OS: Mac OS X → All
Hardware: x86 → All
Attached patch WIP v2 (obsolete) — Splinter Review
A little more polish to go, like filtering out bad keys (actually, bad keys should cause an error to be thrown I'm thinking) and making sure values can't be null anymore, since null is now used to signify async completion for the forEach methods.  I've updated the tests for the new methods, but I could write more stress tests with bad keys and values.
Attachment #385962 - Attachment is obsolete: true
Attached patch for your consideration v1 (obsolete) — Splinter Review
This patch adds polish, tests, and the methods keys and values, which yield the store's keys and values in arrays.
Attachment #385980 - Attachment is obsolete: true
I've gone overboard, morphing the bug accordingly.
Summary: Integrate |has| and |list| into simple storage. → Simple storage improvements
Attached patch for your consideration v2 (obsolete) — Splinter Review
has() wasn't passing key and keyArray back to callbacks, fixed that.  A couple of other small fixes.  JEP update forthcoming.
Attachment #386223 - Attachment is obsolete: true
Attached patch for your consideration v3 (obsolete) — Splinter Review
Uh, has() didn't need to pass keyArray to the callback.  The callback gets existsObject.
Attachment #386332 - Attachment is obsolete: true
Blocks: 496694
Comment on attachment 386379 [details] [diff] [review]
for your consideration v3

Will attach new version shortly.
Attachment #386379 - Attachment is obsolete: true
Allows passing a key array to values() to get specific values in an array.  Adds mapItems() and reduceItems() and tightens up the code by using these internally.  Updated the JEP with these changes also.
Hi Drew,

Do you need us to commit this? Have we given you commit access yet?
Yes, please commit as it's ready to go.  I'm still at the kid's table.
Has been applied in this push: http://hg.mozilla.org/labs/jetpack/rev/34fb13b648b1
Simply adds simple storage to extension/index.html.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: