Re: Futures and transactions

The problem with IndexedDB transactions is when you need to start doing any kind of streaming, where there is the potential for the stream write buffer to fill up, e.g. syncing over the network:

1. Get references to objects within a collection within a transaction.
2. Compare these to objects over the network.
3. Start writing objects to the network, waiting for the network to drain (assuming web sockets) before writing more data.

While this is essentially a long-lived read transaction, this won't work with IDB.

Some have argued that the design goal was to avoid long-lived transactions, but there is a difference between long-lived read transactions and long-lived write transactions.

For MVCC transactions, which I think IDB was once supposed to be aiming for, there is by definition no problem with long running readers, since they do not block each other or writers, they simply read the database at a snapshot in time.

The browser is starting to support stream apis, and I think with that, we need transactions that can be "retained". That is, keep the same semantics as per IDB transactions, but with an additional method "retain(milliseconds)" that would keep the transaction alive for a certain amount of time.

Joran Greef

Received on Tuesday, 9 April 2013 09:35:22 UTC