diff --git a/index.bs b/index.bs index 6b76e40..cba9ef1 100644 --- a/index.bs +++ b/index.bs @@ -929,6 +929,8 @@ following: instead is created automatically when an {{IDBOpenDBRequest/upgradeneeded!!event}} event is fired. +A [=/transaction=] has an manual commit flag, which is initially false. By default, transactions commit automatically when all outstanding requests have been processed. This can be behavior can be modified by options set when creating the transaction. + A [=/transaction=] has a durability hint. This is a hint to the user agent of whether to prioritize performance or durability when committing the transaction. The [=transaction/durability hint=] is one of the following: : "{{IDBTransactionDurability/strict}}" @@ -1036,10 +1038,11 @@ The lifetime of a 1. When each [=/request=] associated with a transaction is [=request/processed=], - a {{IDBRequest/success!!event}} or {{IDBRequest/error!!event}} [=event=] will be - fired. While the event is being [=dispatched=], the transaction + a {{IDBRequest/success!!event}} or {{IDBRequest/error!!event}} [=event=] will be fired. + If the transaction's [=transaction/manual commit flag=] is false (the default), then + while the event is being [=dispatched=], the transaction [=transaction/state=] is set to [=transaction/active=], allowing - additional requests to be made against the transaction. Once the + additional requests to be made against the transaction; once the event dispatch is complete, the transaction's [=transaction/state=] is set to [=transaction/inactive=] again. @@ -1058,11 +1061,12 @@ The lifetime of a [=/object stores=] as well as additions and removals of [=/object stores=] and [=/indexes=]. -1. The implementation must attempt to commit - a transaction when all [=/requests=] placed against the +1. If a transaction's [=transaction/manual commit flag=] is false, then + the implementation must attempt to commit + it when all [=/requests=] placed against the transaction have completed and their returned results handled, no new requests have been placed against the transaction, and the - transaction has not been [=transaction/aborted=] + transaction has not been [=transaction/aborted=]. An explicit call to {{IDBTransaction/commit()}} will initiate a [=transaction/commit=] without waiting for request results to be @@ -1099,7 +1103,7 @@ They will return true if any transactions were cleaned up, or false otherwise. 1. For each [=/transaction=] |transaction| with [=transaction/cleanup event loop=] matching the current [=/event loop=]: - 1. Set |transaction|'s [=transaction/state=] to [=transaction/inactive=]. + 1. If |transaction|'s [=transaction/manual commit flag=] is false, then set |transaction|'s [=transaction/state=] to [=transaction/inactive=]. 1. Clear |transaction|'s [=transaction/cleanup event loop=]. @@ -1120,6 +1124,78 @@ a [=/transaction=] that has successfully [=transaction/committed=]. An event with type abort is fired at a [=/transaction=] that has [=transaction/aborted=]. + + + + + + ### Transaction scheduling ### {#transaction-scheduling} @@ -2429,6 +2505,7 @@ interface IDBDatabase : EventTarget { enum IDBTransactionDurability { "default", "strict", "relaxed" }; dictionary IDBTransactionOptions { + boolean manualCommit = false; IDBTransactionDurability durability = "default"; }; @@ -2622,9 +2699,13 @@ instance on which it was called. Returns a new [=/transaction=] with the given |scope| (which can be a single [=/object store=] [=object-store/name=] or an array of [=object-store/names=]), |mode| ("{{IDBTransactionMode/readonly}}" or "{{IDBTransactionMode/readwrite}}"), - and additional |options| including {{IDBTransactionOptions/durability}} ("{{IDBTransactionDurability/default}}", "{{IDBTransactionDurability/strict}}" or "{{IDBTransactionDurability/relaxed}}"). + and additional |options| including + {{IDBTransactionOptions/manualCommit}} (true or false), and + {{IDBTransactionOptions/durability}} ("{{IDBTransactionDurability/default}}", "{{IDBTransactionDurability/strict}}" or "{{IDBTransactionDurability/relaxed}}"). - The default |mode| is "{{IDBTransactionMode/readonly}}" and the default {{IDBTransactionOptions/durability}} is "{{IDBTransactionDurability/default}}". + The default |mode| is "{{IDBTransactionMode/readonly}}". + The default {{IDBTransactionOptions/manualCommit}} is false. + The default {{IDBTransactionOptions/durability}} is "{{IDBTransactionDurability/default}}". : |connection| . {{IDBDatabase/close()|close}}() :: @@ -2655,7 +2736,11 @@ The transaction(|storeNames|, |mode|, |options|)transaction(|storeNames|, |mode|, |options|) + +