summaryrefslogtreecommitdiff
path: root/src/mongo/client/read_preference.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/client/read_preference.h')
-rw-r--r--src/mongo/client/read_preference.h34
1 files changed, 6 insertions, 28 deletions
diff --git a/src/mongo/client/read_preference.h b/src/mongo/client/read_preference.h
index 5ab06c6f397..5d003ec276a 100644
--- a/src/mongo/client/read_preference.h
+++ b/src/mongo/client/read_preference.h
@@ -31,6 +31,7 @@
#include "mongo/bson/simple_bsonobj_comparator.h"
#include "mongo/client/hedging_mode_gen.h"
+#include "mongo/client/read_preference_gen.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/optime.h"
@@ -40,35 +41,12 @@ namespace mongo {
template <typename T>
class StatusWith;
-enum class ReadPreference {
- /**
- * Read from primary only. All operations produce an error (throw an exception where
- * applicable) if primary is unavailable. Cannot be combined with tags.
- */
- PrimaryOnly = 0,
-
- /**
- * Read from primary if available, otherwise a secondary. Tags will only be applied in the
- * event that the primary is unavailable and a secondary is read from. In this event only
- * secondaries matching the tags provided would be read from.
- */
- PrimaryPreferred,
-
- /**
- * Read from secondary if available, otherwise error.
- */
- SecondaryOnly,
+using ReadPreference = ReadPreferenceEnum;
- /**
- * Read from a secondary if available, otherwise read from the primary.
- */
- SecondaryPreferred,
-
- /**
- * Read from any member.
- */
- Nearest,
-};
+/**
+ * Validate a ReadPreference string. This is intended for use as an IDL validator callback.
+ */
+Status validateReadPreferenceMode(const std::string& prefStr);
/**
* A simple object for representing the list of tags requested by a $readPreference.