diff options
author | Misha Tyulenev <misha@mongodb.com> | 2016-12-12 13:42:04 -0500 |
---|---|---|
committer | Misha Tyulenev <misha@mongodb.com> | 2016-12-12 15:52:40 -0500 |
commit | 3878fd8993b361207a853b8db11a1a3b484ea837 (patch) | |
tree | 50a9f1fd95018f6720a29e24f872448d0db240dd /src/mongo/client/read_preference.h | |
parent | 4777f2c19f3237ba42dcd8a6c776a159ba56f091 (diff) | |
download | mongo-3878fd8993b361207a853b8db11a1a3b484ea837.tar.gz |
SERVER-26927 support integer values for maxStalenessSeconds
Diffstat (limited to 'src/mongo/client/read_preference.h')
-rw-r--r-- | src/mongo/client/read_preference.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/mongo/client/read_preference.h b/src/mongo/client/read_preference.h index 037a895555e..0e80e872970 100644 --- a/src/mongo/client/read_preference.h +++ b/src/mongo/client/read_preference.h @@ -122,14 +122,14 @@ struct ReadPreferenceSetting { * object's copy of tag will have the iterator in the initial * position). */ - ReadPreferenceSetting(ReadPreference pref, TagSet tags, Milliseconds maxStalenessMS); - ReadPreferenceSetting(ReadPreference pref, Milliseconds maxStalenessMS); + ReadPreferenceSetting(ReadPreference pref, TagSet tags, Seconds maxStalenessSeconds); + ReadPreferenceSetting(ReadPreference pref, Seconds maxStalenessSeconds); ReadPreferenceSetting(ReadPreference pref, TagSet tags); explicit ReadPreferenceSetting(ReadPreference pref); inline bool equals(const ReadPreferenceSetting& other) const { return (pref == other.pref) && (tags == other.tags) && - (maxStalenessMS == other.maxStalenessMS) && (minOpTime == other.minOpTime); + (maxStalenessSeconds == other.maxStalenessSeconds) && (minOpTime == other.minOpTime); } /** @@ -144,24 +144,23 @@ struct ReadPreferenceSetting { /** * Parses a ReadPreferenceSetting from a BSON document of the form: - * { mode: <mode>, tags: <array of tags>, maxStalenessMS: Number }. The 'mode' element must a - * string equal to either - * "primary", "primaryPreferred", "secondary", "secondaryPreferred", or "nearest". Although - * the tags array is intended to be an array of unique BSON documents, no further validation - * is performed on it other than checking that it is an array, and that it is empty if - * 'mode' is 'primary'. + * { mode: <mode>, tags: <array of tags>, maxStalenessSeconds: Number }. The 'mode' element must + * be a string equal to either "primary", "primaryPreferred", "secondary", "secondaryPreferred", + * or "nearest". Although the tags array is intended to be an array of unique BSON documents, no + * further validation is performed on it other than checking that it is an array, and that it is + * empty if 'mode' is 'primary'. */ static StatusWith<ReadPreferenceSetting> fromBSON(const BSONObj& readPrefSettingObj); ReadPreference pref; TagSet tags; - Milliseconds maxStalenessMS{}; + Seconds maxStalenessSeconds{}; repl::OpTime minOpTime{}; /** - * The minimal value maxStalenessMS can have. It MUST be ReplicaSetMonitor::kRefreshPeriod * 2 + * The minimal value maxStalenessSeconds can have. */ - static const Milliseconds kMinimalMaxStalenessValue; + static const Seconds kMinimalMaxStalenessValue; }; } // namespace mongo |