From 27681a24b2d7cc09a87cffe268c6b5fc238b35be Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Thu, 26 Sep 2019 11:35:30 -0700 Subject: [PATCH] Sketch out spec text for durability. Fixes #50 --- index.bs | 55 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/index.bs b/index.bs index b5e3aed..60cf01c 100644 --- a/index.bs +++ b/index.bs @@ -939,6 +939,21 @@ following: instead is created automatically when an `upgradeneeded` event is fired. +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: + +: {{"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=]. This is the default for [=/transactions=] if not otherwise specified. + + + A [=/transaction=] optionally has a cleanup event loop which is an [=event loop=]. @@ -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=]. @@ -2694,6 +2713,12 @@ The transaction(|storeNames|,
+ +