[SERVER-63949] Improve IDL to allow multiple server parameters implemented as instances of the same class Created: 23/Feb/22 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | IDL |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | David Storch | Assignee: | Backlog - Service Architecture |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | sa-remove-fv-backlog-22 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Service Arch
|
| Participants: |
| Description |
|
Imagine that we would like to have multiple server parameters which have some shared specialized behavior. This came up on the query team in the context of My first thought for how to achieve this would be to use the cpp_class option offered by the IDL for specialized server parameters. By default, the IDL will generate a new class for each parameter which inherits from IDLServerParameterWithStorage. However, if IDLServerParameterWithStorage does not serve your needs, you can specify cpp_class in order to add some specialized behavior associated with setting or updating the server parameter. So I want to use the IDL to declare multiple server parameters which will both be instances of the same class. Something like this:
However, this does not work with the current IDL. The IDL will generate two declarations of a class called SpecializedDemo, resulting in a compiler error like this:
Instead, I would like to instruct the IDL to register a specialized parameter with a given name which is an instance of a particular class. For instance, the query team could implement a special server parameter class like QueryKnob<T, ShouldFlushCache> and register instances that have the ShouldFlushCache template parameter set to either true or false, depending on the meaning of the server parameter. Presumably QueryKnob would derive from IDLServerParameterWithStorage, just like the IDL-generated classes. The only responsibility of the IDL would be to generate the code to instantiate the server parameter and register it during process initialization; the actual behavior of the server parameter would be written in C++. This could either be a new feature which lives alongside cpp_class, or the work for this ticket could be to change cpp_class to behave as described above. I'm not sure which is easier/better. |