Skip to content

Commit 4ca50ad

Browse files
Clarify transaction lifetime. Resolves #77
1 parent 2550076 commit 4ca50ad

File tree

2 files changed

+112
-88
lines changed

2 files changed

+112
-88
lines changed

index.bs

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,17 @@ A <a for=/>transaction</a> has a <dfn>error</dfn> which is set if the
880880
A <a for=/>transaction</a>'s <a>get the parent</a> algorithm returns the
881881
transaction's <a for=transaction>connection</a>.
882882

883+
A <dfn>read-only transaction</dfn> is
884+
a <a for=/>transaction</a> with <a>mode</a> {{"readonly"}}.
885+
886+
A <dfn>read/write transaction</dfn>
887+
is a <a for=/>transaction</a> with <a>mode</a> {{"readwrite"}}.
888+
889+
890+
<!-- ============================================================ -->
891+
<h4 id=transaction-lifetime-concept>Transaction Lifetime</h4>
892+
<!-- ============================================================ -->
893+
883894
Transactions are expected to be short lived. This is encouraged by the
884895
<a for=transaction lt=commit>automatic committing</a> functionality
885896
described below.
@@ -944,9 +955,10 @@ The <dfn>lifetime</dfn> of a
944955
if an IO error happened, {{UnknownError}} should be used as
945956
|error|.
946957

947-
7. When a transaction can no longer become <a>active</a>, the
948-
implementation must attempt to <dfn lt="commit|committing|committed">commit</dfn> it, as long as the transaction has not been
949-
<a>aborted</a>. This usually happens
958+
7. When a transaction has been started and it can no longer become
959+
<a>active</a>, the implementation must attempt to <dfn
960+
lt="commit|committing|committed">commit</dfn> it, as long as the
961+
transaction has not been <a>aborted</a>. This usually happens
950962
after all requests placed against the transaction have been
951963
executed and their returned results handled, and no new requests
952964
have been placed against the transaction. When a transaction is
@@ -955,10 +967,11 @@ The <dfn>lifetime</dfn> of a
955967
transaction. That is, either all of the changes must be written,
956968
or if an error occurs, such as a disk write error, the
957969
implementation must not write any of the changes to the database.
958-
If such an error occurs, the implementation must <a>abort</a> the transaction by following
959-
the <a>steps for aborting a transaction</a>, otherwise it must <a
960-
for=transaction>commit</a> the transaction by
961-
following the <a>steps for committing a transaction</a>.
970+
If such an error occurs, the implementation must <a>abort</a> the
971+
transaction by following the <a>steps for aborting a
972+
transaction</a>, otherwise it must <a for=transaction>commit</a>
973+
the transaction by following the <a>steps for committing a
974+
transaction</a>.
962975

963976
8. When a transaction is <a for=transaction>committed</a>
964977
or <a>aborted</a>, it is said to be
@@ -968,12 +981,6 @@ The <dfn>lifetime</dfn> of a
968981
implementation must <a>abort</a> the
969982
transaction.
970983

971-
A <dfn>read-only transaction</dfn> is
972-
a <a for=/>transaction</a> with <a>mode</a> {{"readonly"}}.
973-
974-
A <dfn>read/write transaction</dfn>
975-
is a <a for=/>transaction</a> with <a>mode</a> {{"readwrite"}}.
976-
977984
The following constraints define when a <a for=/>transaction</a> can be <a>started</a>:
978985

979986
* Any number of <a>read-only transactions</a> are allowed to run
@@ -5913,6 +5920,8 @@ document's Revision History</a>.
59135920
* Added {{IDBObjectStore/getKey()}} on {{IDBObjectStore}}.
59145921
(<a href="https://github.com/w3c/IndexedDB/issues/26">bug #26</a>)
59155922

5923+
* Clarified when a transaction can attempt to commit.
5924+
(<a href="https://github.com/w3c/IndexedDB/issues/77">bug #77</a>)
59165925

59175926
<!-- ============================================================ -->
59185927
<h2 id=acknowledgements>Acknowledgements</h2>

0 commit comments

Comments
 (0)