The design of the read_preference class could be improved to make it easier to add future additional options.
We should consider the following concrete improvements:
- Adding new setters which support method chaining (i.e. have a return type of read_preference& instead of void).
- Adding a new default constructor.
- Deprecating the existing constructors (which take a read mode and a tag set).
- Deprecating the existing setters.
Once these improvements are made, adding a new option to read_preference will only require adding a new getter and setter, and not touching any constructors.
In addition, using method chaining, users will create simple read preferences with e.g. read_preference().mode(read_preference::read_mode::k_secondary), which is slightly more readable than read_preference(read_preference::read_mode::k_secondary).