[SERVER-53231] Generate V1 commands' base classes in separate .h/.cpp files Created: 04/Dec/20 Updated: 27/Oct/23 Resolved: 22/Dec/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Replication |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | A. Jesse Jiryu Davis | Assignee: | Backlog - Replication Team |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Replication
|
| Participants: |
| Description |
|
Today we generate C++ base classes from IDL for all API Version 1 commands ( Let's give ourselves some flexibility in how we choose to break include-cycles, by generating V1 commands into separate files. |
| Comments |
| Comment by A. Jesse Jiryu Davis [ 22/Dec/20 ] |
|
So far, our alternative approach has worked well, I don't think we need to do this ticket. |
| Comment by A. Jesse Jiryu Davis [ 04/Dec/20 ] |
|
For example, say we generate a C++ base class for the "create" command, which is defined in create.idl and generated in create_gen.h. collection_options.h includes create_gen.h because it needs a few other types defined in create.idl. This leads to an include cycle: src/mongo/db/commands.h includes If we generate separate files just for the base class, say "create_bases_gen.h" and "create_bases_gen.cpp", then only those files would need to include commands.h, and the existing create_gen.h would not include commands.h. (Update idlc_emitter() in idl_tool.py to emit the additional .h/.cpp files, and generate.py to generate them.) Alternatively, each time we add apiVersion: "1" to a command's IDL definition, if its IDL file includes additional types that are used in other header files, then we may need to split the IDL file into two: one for the command, one for the additional types. This could require delicate surgery, but would avoid the change to the code generator. |