[SERVER-43854] Make WriteConcernOptions::parse a static function returning StatusWith<WriteConcernOptions> Created: 05/Oct/19  Updated: 29/Oct/23  Resolved: 12/Nov/19

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 4.3.1

Type: Task Priority: Major - P3
Reporter: Lingzhi Deng Assignee: Lingzhi Deng
Resolution: Fixed Votes: 1
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Repl 2019-10-21, Repl 2019-11-04, Repl 2019-11-18
Participants:

 Description   

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.



 Comments   
Comment by Githook User [ 12/Nov/19 ]

Author:

{'name': 'Lingzhi Deng', 'username': 'ldennis', 'email': 'lingzhi.deng@mongodb.com'}

Message: SERVER-43854: Make WriteConcernOptions::parse a static function returning StatusWith<WriteConcernOptions>
Branch: master
https://github.com/mongodb/mongo/commit/0dc87ca907a725308d21378dcf65380a64f31364

Generated at Thu Feb 08 05:04:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.