aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2016-08-29 13:27:23 -0700
committerGravatar GitHub <noreply@github.com>2016-08-29 13:27:23 -0700
commit8e2c98adf002e747cae01bdabb8b344008dbbe27 (patch)
tree53cf74c1440ec19e0cb9479adefbace16efe8930 /src
parent7acd1a790ac035bfb06dc44185bac84b2bb5e4c7 (diff)
parent1edf65219eb47181ee9495deb4077c1d992d06c2 (diff)
Merge pull request #7839 from markdroth/rename_client_config
Rename grpc_client_config to grpc_resolver_result.
Diffstat (limited to 'src')
-rw-r--r--src/core/ext/client_config/README.md4
-rw-r--r--src/core/ext/client_config/client_channel.c83
-rw-r--r--src/core/ext/client_config/lb_policy_factory.h2
-rw-r--r--src/core/ext/client_config/resolver.c4
-rw-r--r--src/core/ext/client_config/resolver.h12
-rw-r--r--src/core/ext/client_config/resolver_factory.h2
-rw-r--r--src/core/ext/client_config/resolver_result.c (renamed from src/core/ext/client_config/client_config.c)23
-rw-r--r--src/core/ext/client_config/resolver_result.h (renamed from src/core/ext/client_config/client_config.h)27
-rw-r--r--src/core/ext/resolver/dns/native/dns_resolver.c42
-rw-r--r--src/core/ext/resolver/sockaddr/sockaddr_resolver.c18
-rw-r--r--src/python/grpcio/grpc_core_dependencies.py2
11 files changed, 107 insertions, 112 deletions
diff --git a/src/core/ext/client_config/README.md b/src/core/ext/client_config/README.md
index 7024fd540d..eda01e3e71 100644
--- a/src/core/ext/client_config/README.md
+++ b/src/core/ext/client_config/README.md
@@ -12,7 +12,7 @@ data might include:
- a load balancing policy to decide which server to send a request to
- a set of filters to mutate outgoing requests (say, by adding metadata)
-The resolver provides this data as a stream of grpc_client_config objects to
+The resolver provides this data as a stream of grpc_resolver_result objects to
the channel. We represent configuration as a stream so that it can be changed
by the resolver during execution, by reacting to external events (such as a
new configuration file being pushed to some store).
@@ -22,7 +22,7 @@ Load Balancing
--------------
Load balancing configuration is provided by a grpc_lb_policy object, stored as
-part of grpc_client_config.
+part of grpc_resolver_result.
The primary job of the load balancing policies is to pick a target server given only the
initial metadata for a request. It does this by providing a grpc_subchannel
diff --git a/src/core/ext/client_config/client_channel.c b/src/core/ext/client_config/client_channel.c
index 2c0c4abffc..566d3d5ce4 100644
--- a/src/core/ext/client_config/client_channel.c
+++ b/src/core/ext/client_config/client_channel.c
@@ -62,16 +62,15 @@ typedef struct client_channel_channel_data {
/** mutex protecting client configuration, including all
variables below in this data structure */
- gpr_mu mu_config;
- /** currently active load balancer - guarded by mu_config */
+ gpr_mu mu;
+ /** currently active load balancer - guarded by mu */
grpc_lb_policy *lb_policy;
- /** incoming configuration - set by resolver.next
- guarded by mu_config */
- grpc_client_config *incoming_configuration;
+ /** incoming resolver result - set by resolver.next(), guarded by mu */
+ grpc_resolver_result *resolver_result;
/** a list of closures that are all waiting for config to come in */
grpc_closure_list waiting_for_config_closures;
/** resolver callback */
- grpc_closure on_config_changed;
+ grpc_closure on_resolver_result_changed;
/** connectivity state being tracked */
grpc_connectivity_state_tracker state_tracker;
/** when an lb_policy arrives, should we try to exit idle */
@@ -156,9 +155,9 @@ static void on_lb_policy_state_changed(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error) {
lb_policy_connectivity_watcher *w = arg;
- gpr_mu_lock(&w->chand->mu_config);
+ gpr_mu_lock(&w->chand->mu);
on_lb_policy_state_changed_locked(exec_ctx, w, error);
- gpr_mu_unlock(&w->chand->mu_config);
+ gpr_mu_unlock(&w->chand->mu);
GRPC_CHANNEL_STACK_UNREF(exec_ctx, w->chand->owning_stack, "watch_lb_policy");
gpr_free(w);
@@ -178,8 +177,8 @@ static void watch_lb_policy(grpc_exec_ctx *exec_ctx, channel_data *chand,
&w->on_changed);
}
-static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
+static void cc_on_resolver_result_changed(grpc_exec_ctx *exec_ctx, void *arg,
+ grpc_error *error) {
channel_data *chand = arg;
grpc_lb_policy *lb_policy = NULL;
grpc_lb_policy *old_lb_policy;
@@ -187,8 +186,8 @@ static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
int exit_idle = 0;
grpc_error *state_error = GRPC_ERROR_CREATE("No load balancing policy");
- if (chand->incoming_configuration != NULL) {
- lb_policy = grpc_client_config_get_lb_policy(chand->incoming_configuration);
+ if (chand->resolver_result != NULL) {
+ lb_policy = grpc_resolver_result_get_lb_policy(chand->resolver_result);
if (lb_policy != NULL) {
GRPC_LB_POLICY_REF(lb_policy, "channel");
GRPC_LB_POLICY_REF(lb_policy, "config_change");
@@ -197,17 +196,17 @@ static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
grpc_lb_policy_check_connectivity(exec_ctx, lb_policy, &state_error);
}
- grpc_client_config_unref(exec_ctx, chand->incoming_configuration);
+ grpc_resolver_result_unref(exec_ctx, chand->resolver_result);
}
- chand->incoming_configuration = NULL;
+ chand->resolver_result = NULL;
if (lb_policy != NULL) {
grpc_pollset_set_add_pollset_set(exec_ctx, lb_policy->interested_parties,
chand->interested_parties);
}
- gpr_mu_lock(&chand->mu_config);
+ gpr_mu_lock(&chand->mu);
old_lb_policy = chand->lb_policy;
chand->lb_policy = lb_policy;
if (lb_policy != NULL) {
@@ -233,10 +232,9 @@ static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
watch_lb_policy(exec_ctx, chand, lb_policy, state);
}
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver");
- grpc_resolver_next(exec_ctx, chand->resolver,
- &chand->incoming_configuration,
- &chand->on_config_changed);
- gpr_mu_unlock(&chand->mu_config);
+ grpc_resolver_next(exec_ctx, chand->resolver, &chand->resolver_result,
+ &chand->on_resolver_result_changed);
+ gpr_mu_unlock(&chand->mu);
} else {
if (chand->resolver != NULL) {
grpc_resolver_shutdown(exec_ctx, chand->resolver);
@@ -249,7 +247,7 @@ static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
GRPC_ERROR_CREATE_REFERENCING("Got config after disconnection", refs,
GPR_ARRAY_SIZE(refs)),
"resolver_gone");
- gpr_mu_unlock(&chand->mu_config);
+ gpr_mu_unlock(&chand->mu);
}
if (exit_idle) {
@@ -284,7 +282,7 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx,
op->bind_pollset);
}
- gpr_mu_lock(&chand->mu_config);
+ gpr_mu_lock(&chand->mu);
if (op->on_connectivity_state_change != NULL) {
grpc_connectivity_state_notify_on_state_change(
exec_ctx, &chand->state_tracker, op->connectivity_state,
@@ -329,7 +327,7 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx,
}
GRPC_ERROR_UNREF(op->disconnect_with_error);
}
- gpr_mu_unlock(&chand->mu_config);
+ gpr_mu_unlock(&chand->mu);
}
typedef struct {
@@ -377,7 +375,7 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
GPR_ASSERT(connected_subchannel);
- gpr_mu_lock(&chand->mu_config);
+ gpr_mu_lock(&chand->mu);
if (initial_metadata == NULL) {
if (chand->lb_policy != NULL) {
grpc_lb_policy_cancel_pick(exec_ctx, chand->lb_policy,
@@ -392,7 +390,7 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
GRPC_ERROR_CREATE("Pick cancelled"), NULL);
}
}
- gpr_mu_unlock(&chand->mu_config);
+ gpr_mu_unlock(&chand->mu);
GPR_TIMER_END("cc_pick_subchannel", 0);
return 1;
}
@@ -400,7 +398,7 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
grpc_lb_policy *lb_policy = chand->lb_policy;
int r;
GRPC_LB_POLICY_REF(lb_policy, "cc_pick_subchannel");
- gpr_mu_unlock(&chand->mu_config);
+ gpr_mu_unlock(&chand->mu);
r = grpc_lb_policy_pick(exec_ctx, lb_policy, calld->pollent,
initial_metadata, initial_metadata_flags,
connected_subchannel, on_ready);
@@ -411,9 +409,8 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
if (chand->resolver != NULL && !chand->started_resolving) {
chand->started_resolving = 1;
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver");
- grpc_resolver_next(exec_ctx, chand->resolver,
- &chand->incoming_configuration,
- &chand->on_config_changed);
+ grpc_resolver_next(exec_ctx, chand->resolver, &chand->resolver_result,
+ &chand->on_resolver_result_changed);
}
if (chand->resolver != NULL) {
cpa = gpr_malloc(sizeof(*cpa));
@@ -429,7 +426,7 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
grpc_exec_ctx_sched(exec_ctx, on_ready, GRPC_ERROR_CREATE("Disconnected"),
NULL);
}
- gpr_mu_unlock(&chand->mu_config);
+ gpr_mu_unlock(&chand->mu);
GPR_TIMER_END("cc_pick_subchannel", 0);
return 0;
@@ -463,8 +460,9 @@ static void init_channel_elem(grpc_exec_ctx *exec_ctx,
GPR_ASSERT(args->is_last);
GPR_ASSERT(elem->filter == &grpc_client_channel_filter);
- gpr_mu_init(&chand->mu_config);
- grpc_closure_init(&chand->on_config_changed, cc_on_config_changed, chand);
+ gpr_mu_init(&chand->mu);
+ grpc_closure_init(&chand->on_resolver_result_changed,
+ cc_on_resolver_result_changed, chand);
chand->owning_stack = args->channel_stack;
grpc_connectivity_state_init(&chand->state_tracker, GRPC_CHANNEL_IDLE,
@@ -489,7 +487,7 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
}
grpc_connectivity_state_destroy(exec_ctx, &chand->state_tracker);
grpc_pollset_set_destroy(chand->interested_parties);
- gpr_mu_destroy(&chand->mu_config);
+ gpr_mu_destroy(&chand->mu);
}
static void cc_set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
@@ -519,7 +517,7 @@ void grpc_client_channel_set_resolver(grpc_exec_ctx *exec_ctx,
/* post construction initialization: set the transport setup pointer */
grpc_channel_element *elem = grpc_channel_stack_last_element(channel_stack);
channel_data *chand = elem->channel_data;
- gpr_mu_lock(&chand->mu_config);
+ gpr_mu_lock(&chand->mu);
GPR_ASSERT(!chand->resolver);
chand->resolver = resolver;
GRPC_RESOLVER_REF(resolver, "channel");
@@ -527,17 +525,17 @@ void grpc_client_channel_set_resolver(grpc_exec_ctx *exec_ctx,
chand->exit_idle_when_lb_policy_arrives) {
chand->started_resolving = 1;
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver");
- grpc_resolver_next(exec_ctx, resolver, &chand->incoming_configuration,
- &chand->on_config_changed);
+ grpc_resolver_next(exec_ctx, resolver, &chand->resolver_result,
+ &chand->on_resolver_result_changed);
}
- gpr_mu_unlock(&chand->mu_config);
+ gpr_mu_unlock(&chand->mu);
}
grpc_connectivity_state grpc_client_channel_check_connectivity_state(
grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, int try_to_connect) {
channel_data *chand = elem->channel_data;
grpc_connectivity_state out;
- gpr_mu_lock(&chand->mu_config);
+ gpr_mu_lock(&chand->mu);
out = grpc_connectivity_state_check(&chand->state_tracker, NULL);
if (out == GRPC_CHANNEL_IDLE && try_to_connect) {
if (chand->lb_policy != NULL) {
@@ -547,13 +545,12 @@ grpc_connectivity_state grpc_client_channel_check_connectivity_state(
if (!chand->started_resolving && chand->resolver != NULL) {
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver");
chand->started_resolving = 1;
- grpc_resolver_next(exec_ctx, chand->resolver,
- &chand->incoming_configuration,
- &chand->on_config_changed);
+ grpc_resolver_next(exec_ctx, chand->resolver, &chand->resolver_result,
+ &chand->on_resolver_result_changed);
}
}
}
- gpr_mu_unlock(&chand->mu_config);
+ gpr_mu_unlock(&chand->mu);
return out;
}
@@ -588,8 +585,8 @@ void grpc_client_channel_watch_connectivity_state(
grpc_closure_init(&w->my_closure, on_external_watch_complete, w);
GRPC_CHANNEL_STACK_REF(w->chand->owning_stack,
"external_connectivity_watcher");
- gpr_mu_lock(&chand->mu_config);
+ gpr_mu_lock(&chand->mu);
grpc_connectivity_state_notify_on_state_change(
exec_ctx, &chand->state_tracker, state, &w->my_closure);
- gpr_mu_unlock(&chand->mu_config);
+ gpr_mu_unlock(&chand->mu);
}
diff --git a/src/core/ext/client_config/lb_policy_factory.h b/src/core/ext/client_config/lb_policy_factory.h
index 1c89b28b59..da1de3579a 100644
--- a/src/core/ext/client_config/lb_policy_factory.h
+++ b/src/core/ext/client_config/lb_policy_factory.h
@@ -43,8 +43,6 @@
typedef struct grpc_lb_policy_factory grpc_lb_policy_factory;
typedef struct grpc_lb_policy_factory_vtable grpc_lb_policy_factory_vtable;
-/** grpc_lb_policy provides grpc_client_config objects to grpc_channel
- objects */
struct grpc_lb_policy_factory {
const grpc_lb_policy_factory_vtable *vtable;
};
diff --git a/src/core/ext/client_config/resolver.c b/src/core/ext/client_config/resolver.c
index eb004455bd..7534ea62af 100644
--- a/src/core/ext/client_config/resolver.c
+++ b/src/core/ext/client_config/resolver.c
@@ -76,7 +76,7 @@ void grpc_resolver_channel_saw_error(grpc_exec_ctx *exec_ctx,
}
void grpc_resolver_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
- grpc_client_config **target_config,
+ grpc_resolver_result **result,
grpc_closure *on_complete) {
- resolver->vtable->next(exec_ctx, resolver, target_config, on_complete);
+ resolver->vtable->next(exec_ctx, resolver, result, on_complete);
}
diff --git a/src/core/ext/client_config/resolver.h b/src/core/ext/client_config/resolver.h
index 6ecb5d2774..88ac262d51 100644
--- a/src/core/ext/client_config/resolver.h
+++ b/src/core/ext/client_config/resolver.h
@@ -34,14 +34,14 @@
#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_RESOLVER_H
#define GRPC_CORE_EXT_CLIENT_CONFIG_RESOLVER_H
-#include "src/core/ext/client_config/client_config.h"
+#include "src/core/ext/client_config/resolver_result.h"
#include "src/core/ext/client_config/subchannel.h"
#include "src/core/lib/iomgr/iomgr.h"
typedef struct grpc_resolver grpc_resolver;
typedef struct grpc_resolver_vtable grpc_resolver_vtable;
-/** grpc_resolver provides grpc_client_config objects to grpc_channel
+/** grpc_resolver provides grpc_resolver_result objects to grpc_channel
objects */
struct grpc_resolver {
const grpc_resolver_vtable *vtable;
@@ -53,7 +53,7 @@ struct grpc_resolver_vtable {
void (*shutdown)(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver);
void (*channel_saw_error)(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver);
void (*next)(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
- grpc_client_config **target_config, grpc_closure *on_complete);
+ grpc_resolver_result **result, grpc_closure *on_complete);
};
#ifdef GRPC_RESOLVER_REFCOUNT_DEBUG
@@ -82,13 +82,13 @@ void grpc_resolver_channel_saw_error(grpc_exec_ctx *exec_ctx,
grpc_resolver *resolver);
/** Get the next client config. Called by the channel to fetch a new
- configuration. Expected to set *target_config with a new configuration,
+ configuration. Expected to set *result with a new configuration,
and then schedule on_complete for execution.
- If resolution is fatally broken, set *target_config to NULL and
+ If resolution is fatally broken, set *result to NULL and
schedule on_complete. */
void grpc_resolver_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
- grpc_client_config **target_config,
+ grpc_resolver_result **result,
grpc_closure *on_complete);
#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_RESOLVER_H */
diff --git a/src/core/ext/client_config/resolver_factory.h b/src/core/ext/client_config/resolver_factory.h
index 4eb6979aad..f69bf79564 100644
--- a/src/core/ext/client_config/resolver_factory.h
+++ b/src/core/ext/client_config/resolver_factory.h
@@ -41,7 +41,7 @@
typedef struct grpc_resolver_factory grpc_resolver_factory;
typedef struct grpc_resolver_factory_vtable grpc_resolver_factory_vtable;
-/** grpc_resolver provides grpc_client_config objects to grpc_channel
+/** grpc_resolver provides grpc_resolver_result objects to grpc_channel
objects */
struct grpc_resolver_factory {
const grpc_resolver_factory_vtable *vtable;
diff --git a/src/core/ext/client_config/client_config.c b/src/core/ext/client_config/resolver_result.c
index f9b8e68698..c6c4166e83 100644
--- a/src/core/ext/client_config/client_config.c
+++ b/src/core/ext/client_config/resolver_result.c
@@ -31,44 +31,45 @@
*
*/
-#include "src/core/ext/client_config/client_config.h"
+#include "src/core/ext/client_config/resolver_result.h"
#include <string.h>
#include <grpc/support/alloc.h>
-struct grpc_client_config {
+struct grpc_resolver_result {
gpr_refcount refs;
grpc_lb_policy *lb_policy;
};
-grpc_client_config *grpc_client_config_create() {
- grpc_client_config *c = gpr_malloc(sizeof(*c));
+grpc_resolver_result *grpc_resolver_result_create() {
+ grpc_resolver_result *c = gpr_malloc(sizeof(*c));
memset(c, 0, sizeof(*c));
gpr_ref_init(&c->refs, 1);
return c;
}
-void grpc_client_config_ref(grpc_client_config *c) { gpr_ref(&c->refs); }
+void grpc_resolver_result_ref(grpc_resolver_result *c) { gpr_ref(&c->refs); }
-void grpc_client_config_unref(grpc_exec_ctx *exec_ctx, grpc_client_config *c) {
+void grpc_resolver_result_unref(grpc_exec_ctx *exec_ctx,
+ grpc_resolver_result *c) {
if (gpr_unref(&c->refs)) {
if (c->lb_policy != NULL) {
- GRPC_LB_POLICY_UNREF(exec_ctx, c->lb_policy, "client_config");
+ GRPC_LB_POLICY_UNREF(exec_ctx, c->lb_policy, "resolver_result");
}
gpr_free(c);
}
}
-void grpc_client_config_set_lb_policy(grpc_client_config *c,
- grpc_lb_policy *lb_policy) {
+void grpc_resolver_result_set_lb_policy(grpc_resolver_result *c,
+ grpc_lb_policy *lb_policy) {
GPR_ASSERT(c->lb_policy == NULL);
if (lb_policy) {
- GRPC_LB_POLICY_REF(lb_policy, "client_config");
+ GRPC_LB_POLICY_REF(lb_policy, "resolver_result");
}
c->lb_policy = lb_policy;
}
-grpc_lb_policy *grpc_client_config_get_lb_policy(grpc_client_config *c) {
+grpc_lb_policy *grpc_resolver_result_get_lb_policy(grpc_resolver_result *c) {
return c->lb_policy;
}
diff --git a/src/core/ext/client_config/client_config.h b/src/core/ext/client_config/resolver_result.h
index a6290cbcf0..402f7dbd7e 100644
--- a/src/core/ext/client_config/client_config.h
+++ b/src/core/ext/client_config/resolver_result.h
@@ -31,23 +31,22 @@
*
*/
-#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_CLIENT_CONFIG_H
-#define GRPC_CORE_EXT_CLIENT_CONFIG_CLIENT_CONFIG_H
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_RESOLVER_RESULT_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_RESOLVER_RESULT_H
#include "src/core/ext/client_config/lb_policy.h"
-/** Total configuration for a client. Provided, and updated, by
- grpc_resolver */
-typedef struct grpc_client_config grpc_client_config;
+/** Results reported from a grpc_resolver. */
+typedef struct grpc_resolver_result grpc_resolver_result;
-grpc_client_config *grpc_client_config_create();
-void grpc_client_config_ref(grpc_client_config *client_config);
-void grpc_client_config_unref(grpc_exec_ctx *exec_ctx,
- grpc_client_config *client_config);
+grpc_resolver_result *grpc_resolver_result_create();
+void grpc_resolver_result_ref(grpc_resolver_result *client_config);
+void grpc_resolver_result_unref(grpc_exec_ctx *exec_ctx,
+ grpc_resolver_result *client_config);
-void grpc_client_config_set_lb_policy(grpc_client_config *client_config,
- grpc_lb_policy *lb_policy);
-grpc_lb_policy *grpc_client_config_get_lb_policy(
- grpc_client_config *client_config);
+void grpc_resolver_result_set_lb_policy(grpc_resolver_result *client_config,
+ grpc_lb_policy *lb_policy);
+grpc_lb_policy *grpc_resolver_result_get_lb_policy(
+ grpc_resolver_result *client_config);
-#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_CLIENT_CONFIG_H */
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_RESOLVER_RESULT_H */
diff --git a/src/core/ext/resolver/dns/native/dns_resolver.c b/src/core/ext/resolver/dns/native/dns_resolver.c
index 31ac968670..79682e78b5 100644
--- a/src/core/ext/resolver/dns/native/dns_resolver.c
+++ b/src/core/ext/resolver/dns/native/dns_resolver.c
@@ -67,16 +67,16 @@ typedef struct {
gpr_mu mu;
/** are we currently resolving? */
int resolving;
- /** which version of resolved_config have we published? */
+ /** which version of the result have we published? */
int published_version;
- /** which version of resolved_config is current? */
+ /** which version of the result is current? */
int resolved_version;
/** pending next completion, or NULL */
grpc_closure *next_completion;
- /** target config address for next completion */
- grpc_client_config **target_config;
- /** current (fully resolved) config */
- grpc_client_config *resolved_config;
+ /** target result address for next completion */
+ grpc_resolver_result **target_result;
+ /** current (fully resolved) result */
+ grpc_resolver_result *resolved_result;
/** retry timer */
bool have_retry_timer;
grpc_timer retry_timer;
@@ -97,7 +97,7 @@ static void dns_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
static void dns_shutdown(grpc_exec_ctx *exec_ctx, grpc_resolver *r);
static void dns_channel_saw_error(grpc_exec_ctx *exec_ctx, grpc_resolver *r);
static void dns_next(grpc_exec_ctx *exec_ctx, grpc_resolver *r,
- grpc_client_config **target_config,
+ grpc_resolver_result **target_result,
grpc_closure *on_complete);
static const grpc_resolver_vtable dns_resolver_vtable = {
@@ -110,7 +110,7 @@ static void dns_shutdown(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver) {
grpc_timer_cancel(exec_ctx, &r->retry_timer);
}
if (r->next_completion != NULL) {
- *r->target_config = NULL;
+ *r->target_result = NULL;
grpc_exec_ctx_sched(exec_ctx, r->next_completion,
GRPC_ERROR_CREATE("Resolver Shutdown"), NULL);
r->next_completion = NULL;
@@ -130,13 +130,13 @@ static void dns_channel_saw_error(grpc_exec_ctx *exec_ctx,
}
static void dns_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
- grpc_client_config **target_config,
+ grpc_resolver_result **target_result,
grpc_closure *on_complete) {
dns_resolver *r = (dns_resolver *)resolver;
gpr_mu_lock(&r->mu);
GPR_ASSERT(!r->next_completion);
r->next_completion = on_complete;
- r->target_config = target_config;
+ r->target_result = target_result;
if (r->resolved_version == 0 && !r->resolving) {
gpr_backoff_reset(&r->backoff_state);
dns_start_resolving_locked(exec_ctx, r);
@@ -165,7 +165,7 @@ static void dns_on_retry_timer(grpc_exec_ctx *exec_ctx, void *arg,
static void dns_on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error) {
dns_resolver *r = arg;
- grpc_client_config *config = NULL;
+ grpc_resolver_result *result = NULL;
grpc_lb_policy *lb_policy;
gpr_mu_lock(&r->mu);
GPR_ASSERT(r->resolving);
@@ -173,14 +173,14 @@ static void dns_on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
grpc_resolved_addresses *addresses = r->addresses;
if (addresses != NULL) {
grpc_lb_policy_args lb_policy_args;
- config = grpc_client_config_create();
+ result = grpc_resolver_result_create();
memset(&lb_policy_args, 0, sizeof(lb_policy_args));
lb_policy_args.addresses = addresses;
lb_policy_args.client_channel_factory = r->client_channel_factory;
lb_policy =
grpc_lb_policy_create(exec_ctx, r->lb_policy_name, &lb_policy_args);
if (lb_policy != NULL) {
- grpc_client_config_set_lb_policy(config, lb_policy);
+ grpc_resolver_result_set_lb_policy(result, lb_policy);
GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "construction");
}
grpc_resolved_addresses_destroy(addresses);
@@ -203,10 +203,10 @@ static void dns_on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
grpc_timer_init(exec_ctx, &r->retry_timer, next_try, dns_on_retry_timer, r,
now);
}
- if (r->resolved_config) {
- grpc_client_config_unref(exec_ctx, r->resolved_config);
+ if (r->resolved_result) {
+ grpc_resolver_result_unref(exec_ctx, r->resolved_result);
}
- r->resolved_config = config;
+ r->resolved_result = result;
r->resolved_version++;
dns_maybe_finish_next_locked(exec_ctx, r);
gpr_mu_unlock(&r->mu);
@@ -228,9 +228,9 @@ static void dns_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
dns_resolver *r) {
if (r->next_completion != NULL &&
r->resolved_version != r->published_version) {
- *r->target_config = r->resolved_config;
- if (r->resolved_config) {
- grpc_client_config_ref(r->resolved_config);
+ *r->target_result = r->resolved_result;
+ if (r->resolved_result) {
+ grpc_resolver_result_ref(r->resolved_result);
}
grpc_exec_ctx_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE, NULL);
r->next_completion = NULL;
@@ -241,8 +241,8 @@ static void dns_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
static void dns_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *gr) {
dns_resolver *r = (dns_resolver *)gr;
gpr_mu_destroy(&r->mu);
- if (r->resolved_config) {
- grpc_client_config_unref(exec_ctx, r->resolved_config);
+ if (r->resolved_result) {
+ grpc_resolver_result_unref(exec_ctx, r->resolved_result);
}
grpc_client_channel_factory_unref(exec_ctx, r->client_channel_factory);
gpr_free(r->name);
diff --git a/src/core/ext/resolver/sockaddr/sockaddr_resolver.c b/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
index 1f7cce2f43..3807522d2b 100644
--- a/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
+++ b/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
@@ -66,8 +66,8 @@ typedef struct {
int published;
/** pending next completion, or NULL */
grpc_closure *next_completion;
- /** target config address for next completion */
- grpc_client_config **target_config;
+ /** target result address for next completion */
+ grpc_resolver_result **target_result;
} sockaddr_resolver;
static void sockaddr_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *r);
@@ -79,7 +79,7 @@ static void sockaddr_shutdown(grpc_exec_ctx *exec_ctx, grpc_resolver *r);
static void sockaddr_channel_saw_error(grpc_exec_ctx *exec_ctx,
grpc_resolver *r);
static void sockaddr_next(grpc_exec_ctx *exec_ctx, grpc_resolver *r,
- grpc_client_config **target_config,
+ grpc_resolver_result **target_result,
grpc_closure *on_complete);
static const grpc_resolver_vtable sockaddr_resolver_vtable = {
@@ -91,7 +91,7 @@ static void sockaddr_shutdown(grpc_exec_ctx *exec_ctx,
sockaddr_resolver *r = (sockaddr_resolver *)resolver;
gpr_mu_lock(&r->mu);
if (r->next_completion != NULL) {
- *r->target_config = NULL;
+ *r->target_result = NULL;
grpc_exec_ctx_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE, NULL);
r->next_completion = NULL;
}
@@ -108,13 +108,13 @@ static void sockaddr_channel_saw_error(grpc_exec_ctx *exec_ctx,
}
static void sockaddr_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
- grpc_client_config **target_config,
+ grpc_resolver_result **target_result,
grpc_closure *on_complete) {
sockaddr_resolver *r = (sockaddr_resolver *)resolver;
gpr_mu_lock(&r->mu);
GPR_ASSERT(!r->next_completion);
r->next_completion = on_complete;
- r->target_config = target_config;
+ r->target_result = target_result;
sockaddr_maybe_finish_next_locked(exec_ctx, r);
gpr_mu_unlock(&r->mu);
}
@@ -122,17 +122,17 @@ static void sockaddr_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
static void sockaddr_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
sockaddr_resolver *r) {
if (r->next_completion != NULL && !r->published) {
- grpc_client_config *cfg = grpc_client_config_create();
+ grpc_resolver_result *result = grpc_resolver_result_create();
grpc_lb_policy_args lb_policy_args;
memset(&lb_policy_args, 0, sizeof(lb_policy_args));
lb_policy_args.addresses = r->addresses;
lb_policy_args.client_channel_factory = r->client_channel_factory;
grpc_lb_policy *lb_policy =
grpc_lb_policy_create(exec_ctx, r->lb_policy_name, &lb_policy_args);
- grpc_client_config_set_lb_policy(cfg, lb_policy);
+ grpc_resolver_result_set_lb_policy(result, lb_policy);
GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "sockaddr");
r->published = 1;
- *r->target_config = cfg;
+ *r->target_result = result;
grpc_exec_ctx_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE, NULL);
r->next_completion = NULL;
}
diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py
index 7ae76f52c1..660e34d742 100644
--- a/src/python/grpcio/grpc_core_dependencies.py
+++ b/src/python/grpcio/grpc_core_dependencies.py
@@ -220,7 +220,6 @@ CORE_SOURCE_FILES = [
'src/core/ext/client_config/channel_connectivity.c',
'src/core/ext/client_config/client_channel.c',
'src/core/ext/client_config/client_channel_factory.c',
- 'src/core/ext/client_config/client_config.c',
'src/core/ext/client_config/client_config_plugin.c',
'src/core/ext/client_config/connector.c',
'src/core/ext/client_config/default_initial_connect_string.c',
@@ -232,6 +231,7 @@ CORE_SOURCE_FILES = [
'src/core/ext/client_config/resolver.c',
'src/core/ext/client_config/resolver_factory.c',
'src/core/ext/client_config/resolver_registry.c',
+ 'src/core/ext/client_config/resolver_result.c',
'src/core/ext/client_config/subchannel.c',
'src/core/ext/client_config/subchannel_call_holder.c',
'src/core/ext/client_config/subchannel_index.c',