summaryrefslogtreecommitdiff
path: root/src/mongo/db/write_concern_options.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-10-02 17:53:00 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-10-07 18:33:12 -0400
commit9ba3877df2a0734fbf2148c7c16ca18bdf7d4bfb (patch)
treebf88aa2e6171dbc183922f9fd874a80098077cea /src/mongo/db/write_concern_options.cpp
parent8c7455b8260da4ae9ced9285e18c7df8850bf36e (diff)
downloadmongo-9ba3877df2a0734fbf2148c7c16ca18bdf7d4bfb.tar.gz
SERVER-19934 waitForWriteConcern should take write concern parameter
That way sub-operations, which need to wait on a specific write concern, which might be different than the one of the entire operation don't need to change the OperationContext.
Diffstat (limited to 'src/mongo/db/write_concern_options.cpp')
-rw-r--r--src/mongo/db/write_concern_options.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mongo/db/write_concern_options.cpp b/src/mongo/db/write_concern_options.cpp
index 5fba6321b5e..e24f652517d 100644
--- a/src/mongo/db/write_concern_options.cpp
+++ b/src/mongo/db/write_concern_options.cpp
@@ -25,6 +25,8 @@
* it in the license file.
*/
+#include "mongo/platform/basic.h"
+
#include "mongo/db/write_concern_options.h"
#include "mongo/base/status.h"
@@ -64,6 +66,11 @@ WriteConcernOptions::WriteConcernOptions(int numNodes, SyncMode sync, int timeou
WriteConcernOptions::WriteConcernOptions(const std::string& mode, SyncMode sync, int timeout)
: syncMode(sync), wNumNodes(0), wMode(mode), wTimeout(timeout) {}
+WriteConcernOptions::WriteConcernOptions(const std::string& mode,
+ SyncMode sync,
+ Milliseconds timeout)
+ : syncMode(sync), wNumNodes(0), wMode(mode), wTimeout(durationCount<Milliseconds>(timeout)) {}
+
Status WriteConcernOptions::parse(const BSONObj& obj) {
if (obj.isEmpty()) {
return Status(ErrorCodes::FailedToParse, "write concern object cannot be empty");
@@ -179,4 +186,5 @@ BSONObj WriteConcernOptions::toBSON() const {
bool WriteConcernOptions::shouldWaitForOtherNodes() const {
return !wMode.empty() || wNumNodes > 1;
}
-}
+
+} // namespace mongo