pass URI string to resolver impls (#27316)

pull/27361/head
Mark D. Roth 3 years ago committed by GitHub
parent 17862e51dc
commit c4566b7552
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/core/ext/filters/client_channel/resolver_factory.h
  2. 14
      src/core/ext/filters/client_channel/resolver_registry.cc

@ -36,6 +36,8 @@ namespace grpc_core {
struct ResolverArgs {
/// The parsed URI to resolve.
URI uri;
/// The URI string.
std::string uri_string;
/// Channel args to be included in resolver results.
const grpc_channel_args* args = nullptr;
/// Used to drive I/O in the name resolution process.

@ -73,7 +73,7 @@ class RegistryState {
ResolverFactory* factory =
tmp_uri.ok() ? LookupResolverFactory(tmp_uri->scheme()) : nullptr;
if (factory != nullptr) {
*uri = *tmp_uri;
*uri = std::move(*tmp_uri);
return factory;
}
*canonical_target = absl::StrCat(default_prefix_.get(), target);
@ -81,7 +81,7 @@ class RegistryState {
factory =
tmp_uri2.ok() ? LookupResolverFactory(tmp_uri2->scheme()) : nullptr;
if (factory != nullptr) {
*uri = *tmp_uri2;
*uri = std::move(*tmp_uri2);
return factory;
}
if (!tmp_uri.ok() || !tmp_uri2.ok()) {
@ -158,18 +158,16 @@ OrphanablePtr<Resolver> ResolverRegistry::CreateResolver(
std::shared_ptr<WorkSerializer> work_serializer,
std::unique_ptr<Resolver::ResultHandler> result_handler) {
GPR_ASSERT(g_state != nullptr);
std::string canonical_target;
ResolverArgs resolver_args;
ResolverFactory* factory = g_state->FindResolverFactory(
target, &resolver_args.uri, &canonical_target);
target, &resolver_args.uri, &resolver_args.uri_string);
if (factory == nullptr) return nullptr;
if (resolver_args.uri_string.empty()) resolver_args.uri_string = target;
resolver_args.args = args;
resolver_args.pollset_set = pollset_set;
resolver_args.work_serializer = std::move(work_serializer);
resolver_args.result_handler = std::move(result_handler);
OrphanablePtr<Resolver> resolver =
factory == nullptr ? nullptr
: factory->CreateResolver(std::move(resolver_args));
return resolver;
return factory->CreateResolver(std::move(resolver_args));
}
std::string ResolverRegistry::GetDefaultAuthority(absl::string_view target) {

Loading…
Cancel
Save