[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:
Related
is related to CDRIVER-4142 Use separate handshake metadata for c... Backlog

 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.
We would have to plum way to much things through every single function call

Generated at Wed Feb 07 21:12:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.