diff options
author | Mark D. Roth <roth@google.com> | 2017-02-23 08:58:42 -0800 |
---|---|---|
committer | Mark D. Roth <roth@google.com> | 2017-02-23 08:58:42 -0800 |
commit | d6d192d00591ba278115e73d264f279fe248d544 (patch) | |
tree | 5c69a5a5cc49c54da3bbcf0ce8d3c6ec2e74c344 /src/core/lib/transport | |
parent | bf1eb38ced872c8edf973adaa52270cab1480c21 (diff) |
Retry throttling implementation.
Diffstat (limited to 'src/core/lib/transport')
-rw-r--r-- | src/core/lib/transport/service_config.c | 12 | ||||
-rw-r--r-- | src/core/lib/transport/service_config.h | 6 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/core/lib/transport/service_config.c b/src/core/lib/transport/service_config.c index 12da2a88fe..1195f75044 100644 --- a/src/core/lib/transport/service_config.c +++ b/src/core/lib/transport/service_config.c @@ -93,6 +93,18 @@ void grpc_service_config_destroy(grpc_service_config* service_config) { gpr_free(service_config); } +void grpc_service_config_parse_global_params( + const grpc_service_config* service_config, + void (*process_json)(const grpc_json* json, void* arg), void* arg) { + const grpc_json* json = service_config->json_tree; + if (json->type != GRPC_JSON_OBJECT || json->key != NULL) return; + for (grpc_json* field = json->child; field != NULL; field = field->next) { + if (field->key == NULL) return; + if (strcmp(field->key, "methodConfig") == 0) continue; + process_json(field, arg); + } +} + const char* grpc_service_config_get_lb_policy_name( const grpc_service_config* service_config) { const grpc_json* json = service_config->json_tree; diff --git a/src/core/lib/transport/service_config.h b/src/core/lib/transport/service_config.h index cd739a593c..ebfc59b534 100644 --- a/src/core/lib/transport/service_config.h +++ b/src/core/lib/transport/service_config.h @@ -42,6 +42,12 @@ typedef struct grpc_service_config grpc_service_config; grpc_service_config* grpc_service_config_create(const char* json_string); void grpc_service_config_destroy(grpc_service_config* service_config); +/// Invokes \a process_json() for each global parameter in the service +/// config. \a arg is passed as the second argument to \a process_json(). +void grpc_service_config_parse_global_params( + const grpc_service_config* service_config, + void (*process_json)(const grpc_json* json, void* arg), void* arg); + /// Gets the LB policy name from \a service_config. /// Returns NULL if no LB policy name was specified. /// Caller does NOT take ownership. |