Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-43854

Make WriteConcernOptions::parse a static function returning StatusWith<WriteConcernOptions>

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.3.1
    • Affects Version/s: None
    • Component/s: Replication
    • Labels:
    • Fully Compatible
    • Repl 2019-10-21, Repl 2019-11-04, Repl 2019-11-18

      Currently, WriteConcernOptions::parse is a member function of WriteConcernOptions. And in the parse function, it assigns new value to some (but not all) member variables of WriteConcernOptions. This makes it hard to reason about what is the state of the object if parse fails. And in some places (mostly in test), we have to make an instance of the WriteConcernOptions in order to use the parse function. I think it is a better practice to make it a static function returning StatusWith<WriteConcernOptions>. By doing so, it also makes the function easier to use.

            Assignee:
            lingzhi.deng@mongodb.com Lingzhi Deng
            Reporter:
            lingzhi.deng@mongodb.com Lingzhi Deng
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: