summaryrefslogtreecommitdiff
path: root/src/mongo/db/write_concern_options.h
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-02-12 14:28:43 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-02-17 14:23:27 -0500
commit9299908ecce87efded5f16980824490b8933678e (patch)
tree64541e91f5219b829895e0d271a998f1e63ed68b /src/mongo/db/write_concern_options.h
parent55bcbd372df4035b1bb7cae9966c066305ed462e (diff)
downloadmongo-9299908ecce87efded5f16980824490b8933678e.tar.gz
SERVER-22628 Sharding secondary throttle parsing into separate class
Unifies all sharding secondary throttle construction and parsing into a separate class, similarly to what we do for other commands, which need to be serialized/deserialized from BSON.
Diffstat (limited to 'src/mongo/db/write_concern_options.h')
-rw-r--r--src/mongo/db/write_concern_options.h29
1 files changed, 6 insertions, 23 deletions
diff --git a/src/mongo/db/write_concern_options.h b/src/mongo/db/write_concern_options.h
index 5acc54e5294..91320b0d39a 100644
--- a/src/mongo/db/write_concern_options.h
+++ b/src/mongo/db/write_concern_options.h
@@ -39,8 +39,8 @@ struct WriteConcernOptions {
public:
enum class SyncMode { UNSET, NONE, FSYNC, JOURNAL };
- static const int kNoTimeout = 0;
- static const int kNoWaiting = -1;
+ static const int kNoTimeout;
+ static const int kNoWaiting;
static const BSONObj Default;
static const BSONObj Acknowledged;
@@ -58,6 +58,8 @@ public:
WriteConcernOptions(int numNodes, SyncMode sync, int timeout);
+ WriteConcernOptions(int numNodes, SyncMode sync, Milliseconds timeout);
+
WriteConcernOptions(const std::string& mode, SyncMode sync, int timeout);
WriteConcernOptions(const std::string& mode, SyncMode sync, Milliseconds timeout);
@@ -65,26 +67,6 @@ public:
Status parse(const BSONObj& obj);
/**
- * Extracts the write concern settings from the BSONObj. The BSON object should have
- * the format:
- *
- * {
- * ...
- * secondaryThrottle: <bool>, // optional
- * _secondaryThrottle: <bool>, // optional
- * writeConcern: <BSONObj> // optional
- * }
- *
- * Note: secondaryThrottle takes precedence over _secondaryThrottle.
- *
- * Also sets output parameter rawWriteConcernObj if the writeCocnern field exists.
- *
- * Returns OK if the parse was successful. Also returns ErrorCodes::WriteConcernNotDefined
- * when secondary throttle is true but write concern was not specified.
- */
- Status parseSecondaryThrottle(const BSONObj& doc, BSONObj* rawWriteConcernObj);
-
- /**
* Return true if the server needs to wait for other secondary nodes to satisfy this
* write concern setting. Errs on the false positive for non-empty wMode.
*/
@@ -117,4 +99,5 @@ public:
// Timeout in milliseconds.
int wTimeout;
};
-}
+
+} // namespace mongo