8000 Add DatasetTransaction method stubs · HowProgrammingWorks/Transaction@cf9403e · GitHub
[go: up one dir, main page]

Skip to content

Commit cf9403e

Browse files
committed
Add DatasetTransaction method stubs
1 parent fd592e3 commit cf9403e

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

JavaScript/8-dataset.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ Transaction.start = (data) => {
6363

6464
function DatasetTransaction(dataset) {
6565
this.dataset = dataset;
66+
this.log = []; // array of LogRecord { time, operation, delta }
67+
// [
68+
// { id, time: '2018-01-01T12:01:00', operation: 'start' }
69+
// { id, time: '2018-01-01T12:02:15', operation: 'set', delta }
70+
// { id, time: '2018-01-01T12:02:32', operation: 'commit', delta }
71+
// { id, time: '2018-01-01T12:02:37', operation: 'set', delta }
72+
// { id, time: '2018-01-01T12:03:11', operation: 'rollback', delta }
73+
// { id, time: '2018-01-01T12:03:18', operation: 'set', delta }
74+
// { id, time: '2018-01-01T12:04:42', operation: 'timeout' }
75+
// { id, time: '2018-01-01T12:04:52', operation: 'rollback', delta }
76+
// ]
6677
}
6778

6879
DatasetTransaction.start = function(dataset) {
@@ -74,7 +85,15 @@ DatasetTransaction.prototype.commit = function() {
7485
// place implementation here
7586
};
7687

77-
DatasetTransaction.prototype.rollback = function() {
88+
DatasetTransaction.prototype.rollback = function(id /* optional log id */) {
89+
// place implementation here
90+
};
91+
92+
DatasetTransaction.prototype.timeout = function(
93+
msec, // timeout, 0 - disable
94+
commit, // true - commit, false - rollback
95+
listener // (optional) function(boolean) : boolean
96+
) {
7897
// place implementation here
7998
};
8099

0 commit comments

Comments
 (0)
0