summaryrefslogtreecommitdiff
path: root/src/mongo/s/query/cluster_client_cursor.h
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2018-03-15 10:14:01 -0400
committerCharlie Swanson <charlie.swanson@mongodb.com>2018-03-16 16:00:59 -0400
commite85ca2d097655626e1178ba41cfe9863e1ba1c8d (patch)
tree4c1bfd5511cc4bad28be300eda05aa2a2e132dc3 /src/mongo/s/query/cluster_client_cursor.h
parentf092c84d7fbba8220c8fecca51d0a582e90ee4a7 (diff)
downloadmongo-e85ca2d097655626e1178ba41cfe9863e1ba1c8d.tar.gz
SERVER-19410 Add maxTimeMS support to mongos
Diffstat (limited to 'src/mongo/s/query/cluster_client_cursor.h')
-rw-r--r--src/mongo/s/query/cluster_client_cursor.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mongo/s/query/cluster_client_cursor.h b/src/mongo/s/query/cluster_client_cursor.h
index ccc44f7a9a0..c327589a224 100644
--- a/src/mongo/s/query/cluster_client_cursor.h
+++ b/src/mongo/s/query/cluster_client_cursor.h
@@ -148,6 +148,34 @@ public:
* Returns the readPreference for this cursor.
*/
virtual boost::optional<ReadPreferenceSetting> getReadPreference() const = 0;
+
+ //
+ // maxTimeMS support.
+ //
+
+ /**
+ * Returns the amount of time execution time available to this cursor. Only valid at the
+ * beginning of a getMore request, and only really for use by the maxTime tracking code.
+ *
+ * Microseconds::max() == infinity, values less than 1 mean no time left.
+ */
+ Microseconds getLeftoverMaxTimeMicros() const {
+ return _leftoverMaxTimeMicros;
+ }
+
+ /**
+ * Sets the amount of execution time available to this cursor. This is only called when an
+ * operation that uses a cursor is finishing, to update its remaining time.
+ *
+ * Microseconds::max() == infinity, values less than 1 mean no time left.
+ */
+ void setLeftoverMaxTimeMicros(Microseconds leftoverMaxTimeMicros) {
+ _leftoverMaxTimeMicros = leftoverMaxTimeMicros;
+ }
+
+private:
+ // Unused maxTime budget for this cursor.
+ Microseconds _leftoverMaxTimeMicros = Microseconds::max();
};
} // namespace mongo