<div class="gmail_quote">On Tue, Sep 8, 2009 at 5:41 PM, Robert O'Callahan <span dir="ltr"><<a href="mailto:robert@ocallahan.org">robert@ocallahan.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Tue, Sep 8, 2009 at 7:00 PM, Aaron Boodman <span dir="ltr"><<a href="mailto:aa@google.com" target="_blank">aa@google.com</a>></span> wrote:<br></div><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div>On Fri, Sep 4, 2009 at 12:02 AM, Chris Jones<<a href="mailto:cjones@mozilla.com" target="_blank">cjones@mozilla.com</a>> wrote:<br>
> I propose adding the functions<br>
><br>
> window.localStorage.beginTransaction()<br>
> window.localStorage.commitTransaction()<br>
> or<br>
> window.beginTransaction()<br>
> window.commitTransaction()<br>
<br>
</div>I think this is a good idea! I would modify it to follow the pattern<br>
set by the current SQLDatabase proposal, to have a callback, like<br>
this:<br>
<br>
window.localStorage.transaction(function() {<br>
// use local storage here<br>
});<br><br></blockquote></div><div><br>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?<br>
</div></div></blockquote><div><br></div><div>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.</div>
</div>