W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2010

Re: [IndexedDB] Interaction between transactions and objects that allow multiple operations

From: Shawn Wilsher <sdwilsh@mozilla.com>
Date: Wed, 05 May 2010 12:56:20 -0700
Message-ID: <4BE1CD64.2040003@mozilla.com>
To: Jeremy Orlow <jorlow@chromium.org>
CC: Pablo Castro <Pablo.Castro@microsoft.com>, public-webapps WG <public-webapps@w3.org>
On 5/5/2010 11:44 AM, Jeremy Orlow wrote:
> On the other hand, a lot of even the most basic tasks probably should be
> done within a transaction.  But if the easiest way to do something is to
> just run it outside of a transaction, I'm guessing a good portion of users
> (including tutorial websites, people giving advice on forums, etc) will just
> do it that way.  Mandating transactions forces users to be cognizant of
> them.  Maybe that's a good thing...
To be clear, I'm not disagreeing with that.  Mozilla would really love 
to reduce the amount of async steps to do anything with a database. 
Right now, to get something from an object store, we have three steps:
1) open database; wait for callback
2) open object store; wait for callback
3) get from object store; wait for callback

Adding the transaction stuff would result in four steps:
1) open database; wait for callback
2) open transaction; wait for callback
3) open object store; wait for callback
4) get from object store; wait for callback

Maybe we can get rid of this additional step by giving a transaction to 
the consumer immediately available after the call to open, and have a 
property on the connection to access the current transaction.  But that 
might complicate things more too.

This is complicated by the fact that each step blocks similar operations 
(can only open a database when another one is not in the process of 
opening, same with object stores, etc).  This problem goes away with my 
proposal in the past [1], but I'm not sure we have consensus on it (or 
the event based approach for that matter).

Cheers,

Shawn

[1] http://lists.w3.org/Archives/Public/public-webapps/2010JanMar/0961.html



Received on Wednesday, 5 May 2010 19:55:01 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:38 GMT