Skip to content

Commit 20deb99

Browse files
committed
Add some missing JSDocs in Session
1 parent e3a0dfe commit 20deb99

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/v1/session.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,45 @@ class Session {
119119
this._onRunFailure(), this._lastBookmark, this._updateBookmark.bind(this));
120120
}
121121

122+
/**
123+
* Return the bookmark received following the last completed {@link Transaction}.
124+
*
125+
* @return a reference to a previous transac'tion
126+
*/
122127
lastBookmark() {
123128
return this._lastBookmark;
124129
}
125130

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+
*/
126144
readTransaction(transactionWork) {
127145
return this._runTransaction(READ, transactionWork);
128146
}
129147

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+
*/
130161
writeTransaction(transactionWork) {
131162
return this._runTransaction(WRITE, transactionWork);
132163
}

0 commit comments

Comments
 (0)