[CDRIVER-1925] Detecting default or unset value with mongoc_read_prefs_get_max_staleness_seconds() Created: 17/Nov/16 Updated: 11/Sep/19 Resolved: 25/Nov/16 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libmongoc |
| Affects Version/s: | 1.5.0 |
| Fix Version/s: | 1.5.0 |
| Type: | Task | Priority: | Minor - P4 |
| Reporter: | Jeremy Mikola | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
Is there a particular reason that NO_MAX_STALENESS is private, unlike MONGOC_WRITE_CONCERN_W_DEFAULT? As-is, this pushes developers to rely on a magic number in their application to detect a default or simply determine if a read preference has a maxStalenessSeconds option applied to it. Should developers simply assume that any invalid value (i.e. <= 0) is effectively unset? |
| Comments |
| Comment by A. Jesse Jiryu Davis [ 25/Nov/16 ] |
|
https://github.com/mongodb/mongo-c-driver/commit/3bd52c3c285445310517c574b32815db54285972 |
| Comment by A. Jesse Jiryu Davis [ 17/Nov/16 ] |
|
Agreed, we can move NO_MAX_STALENESS to a public header, give it a more dignified name, and document it. Whoever would like to grab this ticket, go ahead. =) |
| Comment by Hannes Magnusson [ 17/Nov/16 ] |
|
I think jmikola has a point. There isn't any reason for wrapping drivers to concerns themselves with the deep underlaying specs that mongoc implements on behalf the wrapped drivers. |
| Comment by A. Jesse Jiryu Davis [ 17/Nov/16 ] |
|
No particular reason, simply limiting public API as much as possible. The spec says -1 means default, so you should assume that -1 means default. |