diff --git a/index.bs b/index.bs index bce7cfa..51262d4 100644 --- a/index.bs +++ b/index.bs @@ -957,6 +957,21 @@ a [=/transaction=] with [=transaction/mode=] {{"readonly"}}. A read/write transaction is a [=/transaction=] with [=transaction/mode=] {{"readwrite"}}. +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. + +: {{"strict"}} +:: The user agent may consider that the [=/transaction=] has successfully [=transaction/committed=] only after verifying that all outstanding changes have been successfully written to a persistent storage medium. +: {{"relaxed"}} +:: The user agent may consider that the [=/transaction=] has successfully [=transaction/committed=] as soon as all outstanding changes have been written to the operating system, without subsequent verification. +: {{"default"}} +:: The user agent should use its default durability behavior for the storage [=/bucket=]. + + + ### Transaction Lifecycle ### {#transaction-lifecycle} @@ -2449,7 +2464,8 @@ interface IDBDatabase : EventTarget { readonly attribute DOMStringList objectStoreNames; [NewObject] IDBTransaction transaction((DOMString or sequence) storeNames, - optional IDBTransactionMode mode = "readonly"); + optional IDBTransactionMode mode = "readonly", + optional IDBTransactionOptions options = {}); void close(); [NewObject] IDBObjectStore createObjectStore( @@ -2464,6 +2480,12 @@ interface IDBDatabase : EventTarget { attribute EventHandler onversionchange; }; +enum IDBTransactionDurability { "default", "strict", "relaxed" }; + +dictionary IDBTransactionOptions { + IDBTransactionDurability durability = "default"; +}; + dictionary IDBObjectStoreParameters { (DOMString or sequence)? keyPath = null; boolean autoIncrement = false; @@ -2661,8 +2683,7 @@ instance on which it was called.
-The transaction(|storeNames|, -|mode|) method, when invoked, must run these steps: +The transaction(|storeNames|, |mode|, |options|) method, when invoked, must run these steps: 1. If a running [=/upgrade transaction=] is associated with the [=/connection=], [=throw=] an "{{InvalidStateError}}" {{DOMException}}. @@ -2683,9 +2704,7 @@ The transaction(|storeNames|, 1. If |mode| is not {{"readonly"}} or {{"readwrite"}}, [=throw=] a [=TypeError=]. -1. Let |transaction| be a newly [=transaction/created=] [=/transaction=] with - |connection|, |mode| and the set of [=/object stores=] named in - |scope|. +1. Let |transaction| be a newly [=transaction/created=] [=/transaction=] with |connection|, |mode|, |options|' {{IDBTransactionOptions/durability}} member, and the set of [=/object stores=] named in |scope|. 1. Set |transaction|'s [=transaction/cleanup event loop=] to the current [=event loop=]. @@ -4860,6 +4879,8 @@ attribute's getter must run these steps: The mode attribute's getter must return **this**'s [=transaction/mode=]. +The durability attribute's getter must return the [=transaction/durability=] of the [=/transaction=]. + The db attribute's getter must return **this**'s [=transaction/connection=]'s associated [=/database=]. @@ -5198,7 +5219,7 @@ To commit a transaction with the |transaction| to commit, run these s 1. If |transaction|'s [=transaction/state=] is no longer [=transaction/committing=], then terminate these steps. - 1. Attempt to write any outstanding changes made by |transaction| to the [=database=]. + 1. Attempt to write any outstanding changes made by |transaction| to the [=database=], considering |transaction|'s [=transaction/durability=] hint. 1. If an error occurs while writing the changes to the [=database=], then run [=abort a transaction=] with |transaction| and an @@ -6814,6 +6835,7 @@ For the revision history of the second edition, see [that document's Revision Hi * Added {{IDBCursor/request}} attribute. ([Issue #255](https://github.com/w3c/IndexedDB/issues/255)) * Removed handling for nonstandard `lastModifiedDate` property of {{File}} objects. ([Issue #215](https://github.com/w3c/IndexedDB/issues/215)) * Remove escaping {{IDBKeyRange/includes()}} method. ([Issue #294](https://github.com/w3c/IndexedDB/issues/294)) +* Added {{IDBTransactionOptions/durability}} option and {{IDBTransaction/durability}} attribute. ([Issue #50](https://github.com/w3c/IndexedDB/issues/50)) # Acknowledgements # {#acknowledgements} @@ -6877,6 +6899,7 @@ Yaron Tausky, Bevis Tseng, Ben Turner, Kyaw Tun, +Adrienne Walker, Hans Wennborg, Shawn Wilsher, Brett Zamir,