Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1055

Add new read_preference setters that support method chaining, deprecate existing setters and constructors

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.2.0-rc0
    • Component/s: API
    • Labels:
    • Sprint:
      Perl/CXX 2017-02-10

      Description

      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).

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: