Simple storage improvements

RESOLVED FIXED in 0.3

Status

P1
normal
RESOLVED FIXED
9 years ago
9 years ago

People

(Reporter: aza, Assigned: adw)

Tracking

unspecified

Details

Attachments

(2 attachments, 5 obsolete attachments)

(Reporter)

Description

9 years ago
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.
(Reporter)

Updated

9 years ago
Priority: -- → P1
Target Milestone: -- → 0.3
(Assignee)

Comment 1

9 years ago
Created attachment 385962 [details] [diff] [review]
WIP v1

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.
(Assignee)

Updated

9 years ago
OS: Mac OS X → All
Hardware: x86 → All
(Assignee)

Comment 2

9 years ago
Created attachment 385980 [details] [diff] [review]
WIP v2

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
(Assignee)

Comment 3

9 years ago
Created attachment 386223 [details] [diff] [review]
for your consideration v1

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
(Assignee)

Comment 4

9 years ago
I've gone overboard, morphing the bug accordingly.
Summary: Integrate |has| and |list| into simple storage. → Simple storage improvements
(Assignee)

Updated

9 years ago
Duplicate of this bug: 499872
(Assignee)

Comment 6

9 years ago
Created attachment 386332 [details] [diff] [review]
for your consideration v2

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
(Assignee)

Comment 7

9 years ago
Created attachment 386379 [details] [diff] [review]
for your consideration v3

Uh, has() didn't need to pass keyArray to the callback.  The callback gets existsObject.
(Assignee)

Updated

9 years ago
Attachment #386332 - Attachment is obsolete: true
(Assignee)

Updated

9 years ago
Blocks: 496694
(Assignee)

Comment 8

9 years ago
Comment on attachment 386379 [details] [diff] [review]
for your consideration v3

Will attach new version shortly.
Attachment #386379 - Attachment is obsolete: true
(Assignee)

Comment 9

9 years ago
Created attachment 386934 [details] [diff] [review]
for your consideration v4

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.
(Reporter)

Comment 10

9 years ago
Hi Drew,

Do you need us to commit this? Have we given you commit access yet?
(Assignee)

Comment 11

9 years ago
Yes, please commit as it's ready to go.  I'm still at the kid's table.
(Reporter)

Comment 12

9 years ago
Has been applied in this push: http://hg.mozilla.org/labs/jetpack/rev/34fb13b648b1
(Assignee)

Comment 13

9 years ago
Created attachment 387085 [details] [diff] [review]
documentation patch

Simply adds simple storage to extension/index.html.
(Assignee)

Updated

9 years ago
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.