W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2009

[whatwg] RFC: Alternatives to storage mutex for cookies and localStorage

From: Jeremy Orlow <jorlow@chromium.org>
Date: Tue, 8 Sep 2009 17:45:52 +0900
Message-ID: <5dd9e5c50909080145x7822925asec46b86ec09c85f2@mail.gmail.com>
On Tue, Sep 8, 2009 at 5:41 PM, Robert O'Callahan <robert at ocallahan.org>wrote:

> On Tue, Sep 8, 2009 at 7:00 PM, Aaron Boodman <aa at google.com> wrote:
>
>> On Fri, Sep 4, 2009 at 12:02 AM, Chris Jones<cjones at mozilla.com> wrote:
>> > I propose adding the functions
>> >
>> >  window.localStorage.beginTransaction()
>> >  window.localStorage.commitTransaction()
>> > or
>> >  window.beginTransaction()
>> >  window.commitTransaction()
>>
>> I think this is a good idea! I would modify it to follow the pattern
>> set by the current SQLDatabase proposal, to have a callback, like
>> this:
>>
>> window.localStorage.transaction(function() {
>>  // use local storage here
>> });
>>
>>
> What is the intended semantics here? Chris' explicit commitTransaction
> would throw an exception if the transaction was aborted due to data
> inconsistency, leaving it up to the script to retry --- and making it clear
> to script authors that non-storage side effects during the transaction are
> not undone. How would you handle transaction aborts?
>

You'd have to implement it via a mutex.  An optimized implementation could
wait until the first operation that can't be un-done before acquiring it,
and do everything optimistically until then.  This is the same situation as
WebDatabase if I understand it correctly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090908/a519a744/attachment.htm>
Received on Tuesday, 8 September 2009 01:45:52 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:52 UTC