summaryrefslogtreecommitdiff
path: root/src/mongo/client/syncclusterconnection.h
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@mongodb.com>2015-08-17 16:52:01 -0400
committerSpencer T Brody <spencer@mongodb.com>2015-08-18 19:27:49 -0400
commit594d851e53c85b2711db41034f9d42e1a0a5c25d (patch)
tree0406d4c8ea17ce60dfc63a0507c04bfc379ec5f7 /src/mongo/client/syncclusterconnection.h
parent4c00f062fd6f29b6f5547ffbc0117c684fddafac (diff)
downloadmongo-594d851e53c85b2711db41034f9d42e1a0a5c25d.tar.gz
SERVER-19543 Add connection hook for checking config server mode to connections used by SyncClusterConnection
Diffstat (limited to 'src/mongo/client/syncclusterconnection.h')
-rw-r--r--src/mongo/client/syncclusterconnection.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/client/syncclusterconnection.h b/src/mongo/client/syncclusterconnection.h
index 08a135c2057..49e571455c1 100644
--- a/src/mongo/client/syncclusterconnection.h
+++ b/src/mongo/client/syncclusterconnection.h
@@ -35,6 +35,7 @@
#include "mongo/bson/bsonobj.h"
#include "mongo/client/dbclientinterface.h"
#include "mongo/stdx/mutex.h"
+#include "mongo/stdx/functional.h"
#include "mongo/util/concurrency/mutex.h"
namespace mongo {
@@ -62,6 +63,15 @@ public:
class QueryHandler;
/**
+ * Hook run on the response of an isMaster request. Run on the DBClientConnections that
+ * SyncClusterConnection uses under the hood. Used to detect and signal when the catalog
+ * manager needs swapping.
+ */
+ using ConnectionValidationHook = stdx::function<Status(
+ const HostAndPort& host, const executor::RemoteCommandResponse& isMasterReply)>;
+
+
+ /**
* @param commaSeparated should be 3 hosts comma separated
*/
SyncClusterConnection(const std::list<HostAndPort>&, double socketTimeout = 0);
@@ -73,6 +83,12 @@ public:
~SyncClusterConnection();
/**
+ * Sets the ConnectionValidationHook that will be used for the DBClientConnections created by
+ * all future constructed SyncClusterConnections.
+ */
+ static void setConnectionValidationHook(ConnectionValidationHook hook);
+
+ /**
* @return true if all servers are up and ready for writes
*/
bool prepare(std::string& errmsg);