[SERVER-79545] Improve ClusterRole class Created: 31/Jul/23 Updated: 05/Sep/23 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Billy Donahue | Assignee: | Backlog - Service Architecture |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | techdebt | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Service Arch
|
||||||||
| Participants: | |||||||||
| Description |
|
The ClusterRole is class filling a pretty Service Arch niche. In working with it, I noticed that it could use a refresh. This thing is basically an unsigned integer with some accessors, and isn't IMO served well by the amount of C++ overloading and out-of-line function calls, nested constants container of a different type, etc. Particularly the nested Value enum, the implicit constructors, and the capitalization of constants like ClusterRole::ShardServer. These are going to be used a lot so I think it's important to bring them inline with our naming convention. I think ServiceArch could take a crack at improving it in these early days. |
| Comments |
| Comment by Billy Donahue [ 03/Sep/23 ] | ||||||||
|
This special behavior for the None value caused a bug while I was working on the CommandRegistry split. I believe the behavior of the function doesn't match its documentation, and the special case for the None value should not be part of the API. This is the docs:
But here's how it works:
So if role is the special value None, then the has function behaves as if it was hasExclusively. |