Class ServiceConfigUtil
java.lang.Object
io.grpc.internal.ServiceConfigUtil
Helper utility to work with service configs.
This class contains helper methods to parse service config JSON values into Java types.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA LoadBalancingConfig that includes the policy name (the key) and its raw config value (parsed JSON).static final class -
Method Summary
Modifier and TypeMethodDescriptiongetHealthCheckedService(Map<String, ?> serviceConfig) Fetches the health-checked service config from service config.static StringgetHealthCheckedServiceName(Map<String, ?> healthCheckedServiceConfig) Fetches the health-checked service name from health-checked service config.getLoadBalancingConfigsFromServiceConfig(Map<String, ?> serviceConfig) Extracts load balancing configs from a service config.static NameResolver.ConfigOrErrorselectLbPolicyFromList(List<ServiceConfigUtil.LbConfig> lbConfigs, LoadBalancerRegistry lbRegistry) Parses and selects a load balancing policy from a non-empty list of raw configs.static ServiceConfigUtil.LbConfigunwrapLoadBalancingConfig(Map<String, ?> lbConfig) Unwrap a LoadBalancingConfig JSON object into aServiceConfigUtil.LbConfig.static List<ServiceConfigUtil.LbConfig> unwrapLoadBalancingConfigList(List<Map<String, ?>> list) Given a JSON list of LoadBalancingConfigs, and convert it into a list of LbConfig.
-
Method Details
-
getHealthCheckedService
-
getHealthCheckedServiceName
-
getLoadBalancingConfigsFromServiceConfig
-
unwrapLoadBalancingConfig
Unwrap a LoadBalancingConfig JSON object into aServiceConfigUtil.LbConfig. The input is a JSON object (map) with exactly one entry, where the key is the policy name and the value is a config object for that policy. -
unwrapLoadBalancingConfigList
public static List<ServiceConfigUtil.LbConfig> unwrapLoadBalancingConfigList(List<Map<String, ?>> list) Given a JSON list of LoadBalancingConfigs, and convert it into a list of LbConfig. -
selectLbPolicyFromList
public static NameResolver.ConfigOrError selectLbPolicyFromList(List<ServiceConfigUtil.LbConfig> lbConfigs, LoadBalancerRegistry lbRegistry) Parses and selects a load balancing policy from a non-empty list of raw configs. If selection is successful, the returned ConfigOrError object will include aServiceConfigUtil.PolicySelectionas its config value.
-