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

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.2.0-rc0
    • Affects Version/s: None
    • Component/s: API
    • Labels:

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

            Assignee:
            sam.rossi@mongodb.com Samuel Rossi (Inactive)
            Reporter:
            rassi J Rassi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: