@@ -289,14 +289,23 @@ class ExecutionOptions {
289
289
290
290
/**
291
291
* Gets the provided timestamp for the execution in microseconds from the unix epoch (00:00:00, January 1st, 1970).
292
- * <p>When a timestamp generator is used, this method returns <code>undefined</code>.</p>
293
292
* @abstract
294
293
* @returns {Number|Long|undefined|null }
295
294
*/
296
295
getTimestamp ( ) {
297
296
298
297
}
299
298
299
+ /**
300
+ * Sets the provided timestamp for the execution in microseconds from the unix epoch (00:00:00, January 1st, 1970).
301
+ * @param {Number|Long|undefined|null } timestamp
302
+ * @abstract
303
+ * @ignore
304
+ */
305
+ setTimestamp ( timestamp ) {
306
+
307
+ }
308
+
300
309
/**
301
310
* @param {Array } hints
302
311
* @abstract
@@ -376,6 +385,7 @@ class DefaultExecutionOptions extends ExecutionOptions {
376
385
this . _routingIndexes = this . _queryOptions . routingIndexes ;
377
386
this . _pageState = typeof this . _queryOptions . pageState === 'string' ?
378
387
utils . allocBufferFromString ( this . _queryOptions . pageState , 'hex' ) : this . _queryOptions . pageState ;
388
+ this . _timestamp = queryOptions . timestamp ;
379
389
this . _preferredHost = null ;
380
390
381
391
this . _client = client ;
@@ -498,10 +508,8 @@ class DefaultExecutionOptions extends ExecutionOptions {
498
508
const generator = this . _client . options . policies . timestampGeneration ;
499
509
500
510
if ( types . protocolVersion . supportsTimestamp ( this . _client . controlConnection . protocolVersion ) && generator ) {
501
- if ( this . _generatedTimestamp === undefined ) {
502
- this . _generatedTimestamp = generator . next ( this . _client ) ;
503
- }
504
- result = this . _generatedTimestamp ;
511
+ result = generator . next ( this . _client ) ;
512
+ this . setTimestamp ( result ) ;
505
513
} else {
506
514
result = null ;
507
515
}
@@ -562,7 +570,11 @@ class DefaultExecutionOptions extends ExecutionOptions {
562
570
}
563
571
564
572
getTimestamp ( ) {
565
- return this . _queryOptions . timestamp ;
573
+ return this . _timestamp ;
574
+ }
575
+
576
+ setTimestamp ( timestamp ) {
577
+ this . _timestamp = timestamp ;
566
578
}
567
579
568
580
/**
0 commit comments