[SERVER-74184] Support SerializationContext in constructors for IDL structs Created: 18/Feb/23 Updated: 29/Oct/23 Resolved: 16/Mar/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 6.3.0-rc1 |
| Fix Version/s: | 7.0.0-rc0 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Hugh Tong (Inactive) | Assignee: | Hugh Tong (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Serverless
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Sprint: | Server Serverless 2023-03-06, Server Serverless 2023-03-20 | ||||||||
| Participants: | |||||||||
| Description |
|
While we can pass SerializationContext via the IDLContextParser when constructing structs via their parseProtected() calls, this is not the only way these structs are constructed. In some cases, we call the parameterized constructors directly, which builds an unpopulated structure. We still need to set the local SerializationContext held in the nested structures at all levels, which is set by the top-level enclosing class, and this needs to be done via the intializer lists. The flags should be set in the following priority order:
Case 1 will allow us to both override when explicitly passing flags in in our manual calls, as well as for nested structures to prioritize flags being passed in by their enclosing class. The above priority list applies to setting the local SerializationContext var, but because the state of these flags will be passed to nestesd structs, we to need to first set the local copy of SerializationContext before any nested structs, which means reordering the flags both in the initializer list and in the declaration. One thing to note is that we can't guarantee the flags exist at all levels without calling parse() because some of the nested structures are constructed manually by the callers, especially those that can't be determined at compile time (such as containerized objetcs). In these cases, the responsibility of setting the flags remains with the caller, otherwise case 3 applies (and may be incorrect). |
| Comments |
| Comment by Githook User [ 15/Mar/23 ] |
|
Author: {'name': 'Hugh Tong', 'email': 'hugh.tong@mongodb.com', 'username': 'cortrain'}Message: |