@@ -119,14 +119,45 @@ class Session {
119
119
this . _onRunFailure ( ) , this . _lastBookmark , this . _updateBookmark . bind ( this ) ) ;
120
120
}
121
121
122
+ /**
123
+ * Return the bookmark received following the last completed {@link Transaction}.
124
+ *
125
+ * @return a reference to a previous transac'tion
126
+ */
122
127
lastBookmark ( ) {
123
128
return this . _lastBookmark ;
124
129
}
125
130
131
+ /**
132
+ * Execute given unit of work in a {@link Driver#READ} transaction.
133
+ *
134
+ * Transaction will automatically be committed unless the given function throws or returns a rejected promise.
135
+ * Some failures of the given function or the commit itself will be retried with exponential backoff with initial
136
+ * delay of 1 second and maximum retry time of 30 seconds. Maximum retry time is configurable via driver config's
137
+ * {@link #maxTransactionRetryTime} property in milliseconds.
138
+ *
139
+ * @param {function(Transaction) } transactionWork - callback that executes operations against
140
+ * a given {@link Transaction}.
141
+ * @return {Promise } resolved promise as returned by the given function or rejected promise when given
142
+ * function or commit fails.
143
+ */
126
144
readTransaction ( transactionWork ) {
127
145
return this . _runTransaction ( READ , transactionWork ) ;
128
146
}
129
147
148
+ /**
149
+ * Execute given unit of work in a {@link Driver#WRITE} transaction.
150
+ *
151
+ * Transaction will automatically be committed unless the given function throws or returns a rejected promise.
152
+ * Some failures of the given function or the commit itself will be retried with exponential backoff with initial
153
+ * delay of 1 second and maximum retry time of 30 seconds. Maximum retry time is configurable via driver config's
154
+ * {@link #maxTransactionRetryTime} property in milliseconds.
155
+ *
156
+ * @param {function(Transaction) } transactionWork - callback that executes operations against
157
+ * a given {@link Transaction}.
158
+ * @return {Promise } resolved promise as returned by the given function or rejected promise when given
159
+ * function or commit fails.
160
+ */
130
161
writeTransaction ( transactionWork ) {
131
162
return this . _runTransaction ( WRITE , transactionWork ) ;
132
163
}
0 commit comments