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

XMLWordPrintableJSON

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

      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
            Reporter:
            Lingzhi Deng
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: