We use service_manager::Identity in primarily two distinct ways:
a) to identify a specific service instance
b) to target a dynamically resolved service instance which may or may not exist
This leads to some confusing semantics in code which uses Identity.
In places where an Identity is meant to reference a specific service instance (such as the Identity a service gets from the Service Manager on startup), we can guarantee that instance group and globally unique ID fields are always valid.
In places where an Identity is used as a sort of service locator (e.g. Connector.BindInterface), arbitrary fields may be omitted and the Identity acts more as a filter for the Service Manager to constrain its search for or creation of the targeted service instance.
We should consider not using Identity for the second case, and instead introducing a type specifically for the purpose of service instance lookup/resolution. Like IdentityFilter or InstanceFilter or something.
Comment 1 by rockot@google.com
, Nov 9Status: Assigned (was: Untriaged)