summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/replication_coordinator_external_state_mock.h
diff options
context:
space:
mode:
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.h16
1 files changed, 14 insertions, 2 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 ecd0f072fed..fd8327f4fee 100644
--- a/src/mongo/db/repl/replication_coordinator_external_state_mock.h
+++ b/src/mongo/db/repl/replication_coordinator_external_state_mock.h
@@ -73,6 +73,10 @@ public:
OpTime onTransitionToPrimary(OperationContext* opCtx) override;
virtual void forwardSecondaryProgress();
virtual bool isSelf(const HostAndPort& host, ServiceContext* service);
+ bool isSelfFastPath(const HostAndPort& host) final;
+ bool isSelfSlowPath(const HostAndPort& host,
+ ServiceContext* service,
+ Milliseconds timeout) final;
virtual HostAndPort getClientHostAndPort(const OperationContext* opCtx);
virtual StatusWith<BSONObj> loadLocalConfigDocument(OperationContext* opCtx);
virtual Status storeLocalConfigDocument(OperationContext* opCtx,
@@ -105,13 +109,20 @@ public:
/**
* Adds "host" to the list of hosts that this mock will match when responding to "isSelf"
- * messages.
+ * messages, including "isSelfFastPath" and "isSelfSlowPath".
*/
void addSelf(const HostAndPort& host);
/**
+ * Adds "host" to the list of hosts that this mock will match when responding to
+ * "isSelfSlowPath" messages with a timeout less than or equal to that given,
+ * but not "isSelfFastPath" messages.
+ */
+ void addSelfSlow(const HostAndPort& host, Milliseconds timeout);
+
+ /**
* Remove all hosts from the list of hosts that this mock will match when responding to "isSelf"
- * messages.
+ * messages. Clears both regular and slow hosts.
*/
void clearSelfHosts();
@@ -208,6 +219,7 @@ private:
StatusWith<OpTime> _lastOpTime;
StatusWith<Date_t> _lastWallTime;
std::vector<HostAndPort> _selfHosts;
+ stdx::unordered_map<HostAndPort, Milliseconds> _selfHostsSlow;
bool _canAcquireGlobalSharedLock;
Status _storeLocalConfigDocumentStatus;
Status _storeLocalLastVoteDocumentStatus;