[CDRIVER-1547] Replace global state with context objects Created: 16/Sep/16 Updated: 07/Mar/23 |
|
| Status: | Backlog |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | David Golden | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
The logger is set globally, which restricts ability to log differently. Just as APM is set on the client, logging callbacks should be set on some non-global context object. If there are other globals, they, too, should be eliminated if at all possible. |
| Comments |
| Comment by Andrew Morrow (Inactive) [ 18/Sep/16 ] |
|
Not necessarily - the handle types can refer back to the associated context, so functions that already take an xyz_t don't need to change. This is a very important request and I don't want it dismissed so blithely. Use of globals in libraries is very disruptive to upstream libraries, as we have seen with SASL and SSL associated issues. Hoisting globals into context objects ensures that multiple independent components can each make use of the C driver in the same address space without risk of conflict. The fact that lower level libraries on which the C driver depends fail to do this correctly does not mean that the C driver should make the same mistake. ABI changes come infrequently for the C driver, and we would not be asking unless we felt it was important, now. |
| Comment by Hannes Magnusson [ 16/Sep/16 ] |
|
This is very unlikely to happen. |