Hi Team,
I have a query related to assigning field numbers to my proto struct. My service is used by other different services like testing service, data service, and others. To assign field numbers I have 2 options:
Assumption: 1-15 fields are reserved
1. I should keep adding the new fields and numbers without leaving any gaps. Example,
test_service_name = 16
test_service_email = 17
data_service_info = 18
user_service_id = 19
shared_service_data = 20
....
The problem here, it is very difficult to distinguish the type of field consumed by what service. The benefit I will get is, that there will be no gaps in the fields.
2. I should keep reserving the field numbers for different services, for example, fields used by testing service should be range from 21-40, user service, 41-60, and data-service 61-80, shared service 100-200. Then the above same struct will look like this:
test_service_name = 21
test_service_email = 22
user_service_id = 41
data_service_info = 61
shared_service_data = 100
It is following the pattern we have in linux passwd file for ranging the accounts.
Which option should be consider as a better option and why? Kindly share your inputs.