summaryrefslogtreecommitdiff
path: root/src/mongo/db/write_concern_options.h
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-20 00:22:50 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2015-06-20 10:56:02 -0400
commit9c2ed42daa8fbbef4a919c21ec564e2db55e8d60 (patch)
tree3814f79c10d7b490948d8cb7b112ac1dd41ceff1 /src/mongo/db/write_concern_options.h
parent01965cf52bce6976637ecb8f4a622aeb05ab256a (diff)
downloadmongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/db/write_concern_options.h')
-rw-r--r--src/mongo/db/write_concern_options.h152
1 files changed, 73 insertions, 79 deletions
diff --git a/src/mongo/db/write_concern_options.h b/src/mongo/db/write_concern_options.h
index 4c9569b1089..217e864a2cf 100644
--- a/src/mongo/db/write_concern_options.h
+++ b/src/mongo/db/write_concern_options.h
@@ -33,83 +33,77 @@
namespace mongo {
- class Status;
-
- struct WriteConcernOptions {
- public:
-
- enum SyncMode { NONE, FSYNC, JOURNAL };
-
- static const int kNoTimeout = 0;
- static const int kNoWaiting = -1;
-
- static const BSONObj Default;
- static const BSONObj Acknowledged;
- static const BSONObj Unacknowledged;
- static const BSONObj Majority;
-
- static const char kMajority[]; // = "majority"
-
- WriteConcernOptions() { reset(); }
-
- WriteConcernOptions(int numNodes,
- SyncMode sync,
- int timeout);
-
- WriteConcernOptions(const std::string& mode,
- SyncMode sync,
- int timeout);
-
- 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.
- */
- bool shouldWaitForOtherNodes() const;
-
- void reset() {
- syncMode = NONE;
- wNumNodes = 0;
- wMode = "";
- wTimeout = 0;
- }
-
- // Returns the BSON representation of this object.
- // Warning: does not return the same object passed on the last parse() call.
- BSONObj toBSON() const;
-
- SyncMode syncMode;
-
- // The w parameter for this write concern. The wMode represents the string format and
- // takes precedence over the numeric format wNumNodes.
- int wNumNodes;
- std::string wMode;
-
- // Timeout in milliseconds.
- int wTimeout;
- };
-
+class Status;
+
+struct WriteConcernOptions {
+public:
+ enum SyncMode { NONE, FSYNC, JOURNAL };
+
+ static const int kNoTimeout = 0;
+ static const int kNoWaiting = -1;
+
+ static const BSONObj Default;
+ static const BSONObj Acknowledged;
+ static const BSONObj Unacknowledged;
+ static const BSONObj Majority;
+
+ static const char kMajority[]; // = "majority"
+
+ WriteConcernOptions() {
+ reset();
+ }
+
+ WriteConcernOptions(int numNodes, SyncMode sync, int timeout);
+
+ WriteConcernOptions(const std::string& mode, SyncMode sync, int timeout);
+
+ 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.
+ */
+ bool shouldWaitForOtherNodes() const;
+
+ void reset() {
+ syncMode = NONE;
+ wNumNodes = 0;
+ wMode = "";
+ wTimeout = 0;
+ }
+
+ // Returns the BSON representation of this object.
+ // Warning: does not return the same object passed on the last parse() call.
+ BSONObj toBSON() const;
+
+ SyncMode syncMode;
+
+ // The w parameter for this write concern. The wMode represents the string format and
+ // takes precedence over the numeric format wNumNodes.
+ int wNumNodes;
+ std::string wMode;
+
+ // Timeout in milliseconds.
+ int wTimeout;
+};
}
-