diff options
author | Charlie Swanson <charlie.swanson@mongodb.com> | 2018-03-15 10:14:01 -0400 |
---|---|---|
committer | Charlie Swanson <charlie.swanson@mongodb.com> | 2018-03-16 16:00:59 -0400 |
commit | e85ca2d097655626e1178ba41cfe9863e1ba1c8d (patch) | |
tree | 4c1bfd5511cc4bad28be300eda05aa2a2e132dc3 /src/mongo/s/query/cluster_client_cursor.h | |
parent | f092c84d7fbba8220c8fecca51d0a582e90ee4a7 (diff) | |
download | mongo-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.h | 28 |
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 |