summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/replication_coordinator_external_state_mock.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/repl/replication_coordinator_external_state_mock.h
parent01965cf52bce6976637ecb8f4a622aeb05ab256a (diff)
downloadmongo-9c2ed42daa8fbbef4a919c21ec564e2db55e8d60.tar.gz
SERVER-18579: Clang-Format - reformat code, no comment reflow
Diffstat (limited to 'src/mongo/db/repl/replication_coordinator_external_state_mock.h')
-rw-r--r--src/mongo/db/repl/replication_coordinator_external_state_mock.h201
1 files changed, 101 insertions, 100 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_external_state_mock.h b/src/mongo/db/repl/replication_coordinator_external_state_mock.h
index 1602601a33a..a93b4a5038a 100644
--- a/src/mongo/db/repl/replication_coordinator_external_state_mock.h
+++ b/src/mongo/db/repl/replication_coordinator_external_state_mock.h
@@ -44,103 +44,104 @@
namespace mongo {
namespace repl {
- class ReplicationCoordinatorExternalStateMock : public ReplicationCoordinatorExternalState {
- MONGO_DISALLOW_COPYING(ReplicationCoordinatorExternalStateMock);
- public:
- class GlobalSharedLockAcquirer;
-
- ReplicationCoordinatorExternalStateMock();
- virtual ~ReplicationCoordinatorExternalStateMock();
- virtual void startThreads();
- virtual void startMasterSlave(OperationContext*);
- virtual void shutdown();
- virtual void initiateOplog(OperationContext* txn);
- virtual void forwardSlaveProgress();
- virtual OID ensureMe(OperationContext*);
- virtual bool isSelf(const HostAndPort& host);
- virtual HostAndPort getClientHostAndPort(const OperationContext* txn);
- virtual StatusWith<BSONObj> loadLocalConfigDocument(OperationContext* txn);
- virtual Status storeLocalConfigDocument(OperationContext* txn, const BSONObj& config);
- virtual StatusWith<LastVote> loadLocalLastVoteDocument(OperationContext* txn);
- virtual Status storeLocalLastVoteDocument(OperationContext* txn, const LastVote& lastVote);
- virtual void setGlobalTimestamp(const Timestamp& newTime);
- virtual StatusWith<OpTime> loadLastOpTime(OperationContext* txn);
- virtual void closeConnections();
- virtual void killAllUserOperations(OperationContext* txn);
- virtual void clearShardingState();
- virtual void signalApplierToChooseNewSyncSource();
- virtual OperationContext* createOperationContext(const std::string& threadName);
- virtual void dropAllTempCollections(OperationContext* txn);
-
- /**
- * Adds "host" to the list of hosts that this mock will match when responding to "isSelf"
- * messages.
- */
- void addSelf(const HostAndPort& host);
-
- /**
- * Sets the return value for subsequent calls to loadLocalConfigDocument().
- */
- void setLocalConfigDocument(const StatusWith<BSONObj>& localConfigDocument);
-
- /**
- * Sets the return value for subsequent calls to loadLocalLastVoteDocument().
- */
- void setLocalLastVoteDocument(const StatusWith<LastVote>& localLastVoteDocument);
-
- /**
- * Sets the return value for subsequent calls to getClientHostAndPort().
- */
- void setClientHostAndPort(const HostAndPort& clientHostAndPort);
-
- /**
- * Sets the return value for subsequent calls to loadLastOpTimeApplied.
- */
- void setLastOpTime(const StatusWith<OpTime>& lastApplied);
-
- /**
- * Sets the return value for subsequent calls to storeLocalConfigDocument().
- * If "status" is Status::OK(), the subsequent calls will call the underlying funtion.
- */
- void setStoreLocalConfigDocumentStatus(Status status);
-
- /**
- * Sets whether or not subsequent calls to storeLocalConfigDocument() should hang
- * indefinitely or not based on the value of "hang".
- */
- void setStoreLocalConfigDocumentToHang(bool hang);
-
- /**
- * Sets the return value for subsequent calls to storeLocalLastVoteDocument().
- * If "status" is Status::OK(), the subsequent calls will call the underlying funtion.
- */
- void setStoreLocalLastVoteDocumentStatus(Status status);
-
- /**
- * Sets whether or not subsequent calls to storeLocalLastVoteDocument() should hang
- * indefinitely or not based on the value of "hang".
- */
- void setStoreLocalLastVoteDocumentToHang(bool hang);
-
- private:
- StatusWith<BSONObj> _localRsConfigDocument;
- StatusWith<LastVote> _localRsLastVoteDocument;
- StatusWith<OpTime> _lastOpTime;
- std::vector<HostAndPort> _selfHosts;
- bool _canAcquireGlobalSharedLock;
- Status _storeLocalConfigDocumentStatus;
- Status _storeLocalLastVoteDocumentStatus;
- // mutex and cond var for controlling stroeLocalConfigDocument()'s hanging
- stdx::mutex _shouldHangConfigMutex;
- stdx::condition_variable _shouldHangConfigCondVar;
- // mutex and cond var for controlling stroeLocalLastVoteDocument()'s hanging
- stdx::mutex _shouldHangLastVoteMutex;
- stdx::condition_variable _shouldHangLastVoteCondVar;
- bool _storeLocalConfigDocumentShouldHang;
- bool _storeLocalLastVoteDocumentShouldHang;
- bool _connectionsClosed;
- HostAndPort _clientHostAndPort;
- };
-
-} // namespace repl
-} // namespace mongo
+class ReplicationCoordinatorExternalStateMock : public ReplicationCoordinatorExternalState {
+ MONGO_DISALLOW_COPYING(ReplicationCoordinatorExternalStateMock);
+
+public:
+ class GlobalSharedLockAcquirer;
+
+ ReplicationCoordinatorExternalStateMock();
+ virtual ~ReplicationCoordinatorExternalStateMock();
+ virtual void startThreads();
+ virtual void startMasterSlave(OperationContext*);
+ virtual void shutdown();
+ virtual void initiateOplog(OperationContext* txn);
+ virtual void forwardSlaveProgress();
+ virtual OID ensureMe(OperationContext*);
+ virtual bool isSelf(const HostAndPort& host);
+ virtual HostAndPort getClientHostAndPort(const OperationContext* txn);
+ virtual StatusWith<BSONObj> loadLocalConfigDocument(OperationContext* txn);
+ virtual Status storeLocalConfigDocument(OperationContext* txn, const BSONObj& config);
+ virtual StatusWith<LastVote> loadLocalLastVoteDocument(OperationContext* txn);
+ virtual Status storeLocalLastVoteDocument(OperationContext* txn, const LastVote& lastVote);
+ virtual void setGlobalTimestamp(const Timestamp& newTime);
+ virtual StatusWith<OpTime> loadLastOpTime(OperationContext* txn);
+ virtual void closeConnections();
+ virtual void killAllUserOperations(OperationContext* txn);
+ virtual void clearShardingState();
+ virtual void signalApplierToChooseNewSyncSource();
+ virtual OperationContext* createOperationContext(const std::string& threadName);
+ virtual void dropAllTempCollections(OperationContext* txn);
+
+ /**
+ * Adds "host" to the list of hosts that this mock will match when responding to "isSelf"
+ * messages.
+ */
+ void addSelf(const HostAndPort& host);
+
+ /**
+ * Sets the return value for subsequent calls to loadLocalConfigDocument().
+ */
+ void setLocalConfigDocument(const StatusWith<BSONObj>& localConfigDocument);
+
+ /**
+ * Sets the return value for subsequent calls to loadLocalLastVoteDocument().
+ */
+ void setLocalLastVoteDocument(const StatusWith<LastVote>& localLastVoteDocument);
+
+ /**
+ * Sets the return value for subsequent calls to getClientHostAndPort().
+ */
+ void setClientHostAndPort(const HostAndPort& clientHostAndPort);
+
+ /**
+ * Sets the return value for subsequent calls to loadLastOpTimeApplied.
+ */
+ void setLastOpTime(const StatusWith<OpTime>& lastApplied);
+
+ /**
+ * Sets the return value for subsequent calls to storeLocalConfigDocument().
+ * If "status" is Status::OK(), the subsequent calls will call the underlying funtion.
+ */
+ void setStoreLocalConfigDocumentStatus(Status status);
+
+ /**
+ * Sets whether or not subsequent calls to storeLocalConfigDocument() should hang
+ * indefinitely or not based on the value of "hang".
+ */
+ void setStoreLocalConfigDocumentToHang(bool hang);
+
+ /**
+ * Sets the return value for subsequent calls to storeLocalLastVoteDocument().
+ * If "status" is Status::OK(), the subsequent calls will call the underlying funtion.
+ */
+ void setStoreLocalLastVoteDocumentStatus(Status status);
+
+ /**
+ * Sets whether or not subsequent calls to storeLocalLastVoteDocument() should hang
+ * indefinitely or not based on the value of "hang".
+ */
+ void setStoreLocalLastVoteDocumentToHang(bool hang);
+
+private:
+ StatusWith<BSONObj> _localRsConfigDocument;
+ StatusWith<LastVote> _localRsLastVoteDocument;
+ StatusWith<OpTime> _lastOpTime;
+ std::vector<HostAndPort> _selfHosts;
+ bool _canAcquireGlobalSharedLock;
+ Status _storeLocalConfigDocumentStatus;
+ Status _storeLocalLastVoteDocumentStatus;
+ // mutex and cond var for controlling stroeLocalConfigDocument()'s hanging
+ stdx::mutex _shouldHangConfigMutex;
+ stdx::condition_variable _shouldHangConfigCondVar;
+ // mutex and cond var for controlling stroeLocalLastVoteDocument()'s hanging
+ stdx::mutex _shouldHangLastVoteMutex;
+ stdx::condition_variable _shouldHangLastVoteCondVar;
+ bool _storeLocalConfigDocumentShouldHang;
+ bool _storeLocalLastVoteDocumentShouldHang;
+ bool _connectionsClosed;
+ HostAndPort _clientHostAndPort;
+};
+
+} // namespace repl
+} // namespace mongo