[xDS] move XdsConfig out of XdsDependencyManager (#37564)

This is needed to use `XdsConfig` in an xDS HTTP filter without causing a circular dependency, which will be needed as part of gRFC A83 (https://github.com/grpc/proposal/pull/438).

Closes #37564

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37564 from markdroth:xds_config_dependency_refactor 877d9afdc0
PiperOrigin-RevId: 666950471
pull/37550/head
Mark D. Roth 3 months ago committed by Copybara-Service
parent 1582c3df46
commit e3f8296d3a
  1. 1
      CMakeLists.txt
  2. 1
      Makefile
  3. 2
      Package.swift
  4. 2
      build_autogenerated.yaml
  5. 1
      config.m4
  6. 1
      config.w32
  7. 2
      gRPC-C++.podspec
  8. 3
      gRPC-Core.podspec
  9. 2
      grpc.gemspec
  10. 2
      package.xml
  11. 32
      src/core/BUILD
  12. 2
      src/core/load_balancing/xds/cds.cc
  13. 4
      src/core/load_balancing/xds/xds_cluster_impl.cc
  14. 5
      src/core/load_balancing/xds/xds_override_host.cc
  15. 96
      src/core/resolver/xds/xds_config.cc
  16. 109
      src/core/resolver/xds/xds_config.h
  17. 65
      src/core/resolver/xds/xds_dependency_manager.cc
  18. 70
      src/core/resolver/xds/xds_dependency_manager.h
  19. 10
      src/core/resolver/xds/xds_resolver.cc
  20. 1
      src/python/grpcio/grpc_core_dependencies.py
  21. 6
      test/core/load_balancing/xds_override_host_test.cc
  22. 2
      tools/doxygen/Doxyfile.c++.internal
  23. 2
      tools/doxygen/Doxyfile.core.internal

1
CMakeLists.txt generated

@ -2567,6 +2567,7 @@ add_library(grpc
src/core/resolver/resolver.cc
src/core/resolver/resolver_registry.cc
src/core/resolver/sockaddr/sockaddr_resolver.cc
src/core/resolver/xds/xds_config.cc
src/core/resolver/xds/xds_dependency_manager.cc
src/core/resolver/xds/xds_resolver.cc
src/core/server/server.cc

1
Makefile generated

@ -1404,6 +1404,7 @@ LIBGRPC_SRC = \
src/core/resolver/resolver.cc \
src/core/resolver/resolver_registry.cc \
src/core/resolver/sockaddr/sockaddr_resolver.cc \
src/core/resolver/xds/xds_config.cc \
src/core/resolver/xds/xds_dependency_manager.cc \
src/core/resolver/xds/xds_resolver.cc \
src/core/server/server.cc \

2
Package.swift generated

@ -1813,6 +1813,8 @@ let package = Package(
"src/core/resolver/resolver_registry.h",
"src/core/resolver/server_address.h",
"src/core/resolver/sockaddr/sockaddr_resolver.cc",
"src/core/resolver/xds/xds_config.cc",
"src/core/resolver/xds/xds_config.h",
"src/core/resolver/xds/xds_dependency_manager.cc",
"src/core/resolver/xds/xds_dependency_manager.h",
"src/core/resolver/xds/xds_resolver.cc",

@ -1158,6 +1158,7 @@ libs:
- src/core/resolver/resolver_factory.h
- src/core/resolver/resolver_registry.h
- src/core/resolver/server_address.h
- src/core/resolver/xds/xds_config.h
- src/core/resolver/xds/xds_dependency_manager.h
- src/core/resolver/xds/xds_resolver_attributes.h
- src/core/server/server.h
@ -1980,6 +1981,7 @@ libs:
- src/core/resolver/resolver.cc
- src/core/resolver/resolver_registry.cc
- src/core/resolver/sockaddr/sockaddr_resolver.cc
- src/core/resolver/xds/xds_config.cc
- src/core/resolver/xds/xds_dependency_manager.cc
- src/core/resolver/xds/xds_resolver.cc
- src/core/server/server.cc

1
config.m4 generated

@ -779,6 +779,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/resolver/resolver.cc \
src/core/resolver/resolver_registry.cc \
src/core/resolver/sockaddr/sockaddr_resolver.cc \
src/core/resolver/xds/xds_config.cc \
src/core/resolver/xds/xds_dependency_manager.cc \
src/core/resolver/xds/xds_resolver.cc \
src/core/server/server.cc \

1
config.w32 generated

@ -744,6 +744,7 @@ if (PHP_GRPC != "no") {
"src\\core\\resolver\\resolver.cc " +
"src\\core\\resolver\\resolver_registry.cc " +
"src\\core\\resolver\\sockaddr\\sockaddr_resolver.cc " +
"src\\core\\resolver\\xds\\xds_config.cc " +
"src\\core\\resolver\\xds\\xds_dependency_manager.cc " +
"src\\core\\resolver\\xds\\xds_resolver.cc " +
"src\\core\\server\\server.cc " +

2
gRPC-C++.podspec generated

@ -1262,6 +1262,7 @@ Pod::Spec.new do |s|
'src/core/resolver/resolver_factory.h',
'src/core/resolver/resolver_registry.h',
'src/core/resolver/server_address.h',
'src/core/resolver/xds/xds_config.h',
'src/core/resolver/xds/xds_dependency_manager.h',
'src/core/resolver/xds/xds_resolver_attributes.h',
'src/core/server/server.h',
@ -2548,6 +2549,7 @@ Pod::Spec.new do |s|
'src/core/resolver/resolver_factory.h',
'src/core/resolver/resolver_registry.h',
'src/core/resolver/server_address.h',
'src/core/resolver/xds/xds_config.h',
'src/core/resolver/xds/xds_dependency_manager.h',
'src/core/resolver/xds/xds_resolver_attributes.h',
'src/core/server/server.h',

3
gRPC-Core.podspec generated

@ -1929,6 +1929,8 @@ Pod::Spec.new do |s|
'src/core/resolver/resolver_registry.h',
'src/core/resolver/server_address.h',
'src/core/resolver/sockaddr/sockaddr_resolver.cc',
'src/core/resolver/xds/xds_config.cc',
'src/core/resolver/xds/xds_config.h',
'src/core/resolver/xds/xds_dependency_manager.cc',
'src/core/resolver/xds/xds_dependency_manager.h',
'src/core/resolver/xds/xds_resolver.cc',
@ -3327,6 +3329,7 @@ Pod::Spec.new do |s|
'src/core/resolver/resolver_factory.h',
'src/core/resolver/resolver_registry.h',
'src/core/resolver/server_address.h',
'src/core/resolver/xds/xds_config.h',
'src/core/resolver/xds/xds_dependency_manager.h',
'src/core/resolver/xds/xds_resolver_attributes.h',
'src/core/server/server.h',

2
grpc.gemspec generated

@ -1815,6 +1815,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/resolver/resolver_registry.h )
s.files += %w( src/core/resolver/server_address.h )
s.files += %w( src/core/resolver/sockaddr/sockaddr_resolver.cc )
s.files += %w( src/core/resolver/xds/xds_config.cc )
s.files += %w( src/core/resolver/xds/xds_config.h )
s.files += %w( src/core/resolver/xds/xds_dependency_manager.cc )
s.files += %w( src/core/resolver/xds/xds_dependency_manager.h )
s.files += %w( src/core/resolver/xds/xds_resolver.cc )

2
package.xml generated

@ -1797,6 +1797,8 @@
<file baseinstalldir="/" name="src/core/resolver/resolver_registry.h" role="src" />
<file baseinstalldir="/" name="src/core/resolver/server_address.h" role="src" />
<file baseinstalldir="/" name="src/core/resolver/sockaddr/sockaddr_resolver.cc" role="src" />
<file baseinstalldir="/" name="src/core/resolver/xds/xds_config.cc" role="src" />
<file baseinstalldir="/" name="src/core/resolver/xds/xds_config.h" role="src" />
<file baseinstalldir="/" name="src/core/resolver/xds/xds_dependency_manager.cc" role="src" />
<file baseinstalldir="/" name="src/core/resolver/xds/xds_dependency_manager.h" role="src" />
<file baseinstalldir="/" name="src/core/resolver/xds/xds_resolver.cc" role="src" />

@ -5904,6 +5904,7 @@ grpc_cc_library(
"unique_type_name",
"xds_cluster",
"xds_common_types",
"xds_config",
"xds_dependency_manager",
"xds_health_status",
"//:config",
@ -5969,8 +5970,8 @@ grpc_cc_library(
"resolved_address",
"subchannel_interface",
"validation_errors",
"xds_config",
"xds_credentials",
"xds_dependency_manager",
"xds_endpoint",
"//:call_tracer",
"//:config",
@ -6682,7 +6683,7 @@ grpc_cc_library(
"resolved_address",
"subchannel_interface",
"validation_errors",
"xds_dependency_manager",
"xds_config",
"xds_health_status",
"//:config",
"//:debug_location",
@ -7027,6 +7028,31 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "xds_config",
srcs = [
"resolver/xds/xds_config.cc",
],
hdrs = [
"resolver/xds/xds_config.h",
],
external_deps = [
"absl/container:flat_hash_map",
"absl/status:statusor",
"absl/strings",
"absl/types:variant",
],
language = "c++",
deps = [
"match",
"ref_counted",
"xds_cluster",
"xds_endpoint",
"xds_listener",
"xds_route_config",
],
)
grpc_cc_library(
name = "xds_dependency_manager",
srcs = [
@ -7049,6 +7075,7 @@ grpc_cc_library(
"match",
"ref_counted",
"xds_cluster",
"xds_config",
"xds_endpoint",
"xds_listener",
"xds_route_config",
@ -7099,6 +7126,7 @@ grpc_cc_library(
"ref_counted",
"slice",
"time",
"xds_config",
"xds_dependency_manager",
"xds_http_filter",
"xds_listener",

@ -78,8 +78,6 @@ bool XdsAggregateClusterBackwardCompatibilityEnabled() {
return parse_succeeded && parsed_value;
}
using XdsConfig = XdsDependencyManager::XdsConfig;
constexpr absl::string_view kCds = "cds_experimental";
// Config for this LB policy.

@ -62,7 +62,7 @@
#include "src/core/load_balancing/subchannel_interface.h"
#include "src/core/load_balancing/xds/xds_channel_args.h"
#include "src/core/resolver/endpoint_addresses.h"
#include "src/core/resolver/xds/xds_dependency_manager.h"
#include "src/core/resolver/xds/xds_config.h"
#include "src/core/resolver/xds/xds_resolver_attributes.h"
#include "src/core/telemetry/call_tracer.h"
#include "src/core/util/json/json.h"
@ -79,8 +79,6 @@ namespace grpc_core {
namespace {
using XdsConfig = XdsDependencyManager::XdsConfig;
//
// global circuit breaker atomic map
//

@ -77,7 +77,7 @@
#include "src/core/load_balancing/lb_policy_registry.h"
#include "src/core/load_balancing/subchannel_interface.h"
#include "src/core/resolver/endpoint_addresses.h"
#include "src/core/resolver/xds/xds_dependency_manager.h"
#include "src/core/resolver/xds/xds_config.h"
#include "src/core/util/json/json.h"
#include "src/core/util/json/json_args.h"
#include "src/core/util/json/json_object_loader.h"
@ -738,8 +738,7 @@ absl::Status XdsOverrideHostLb::UpdateLocked(UpdateArgs args) {
}
auto new_config = args.config.TakeAsSubclass<XdsOverrideHostLbConfig>();
// Get xDS config.
auto new_xds_config =
args.args.GetObjectRef<XdsDependencyManager::XdsConfig>();
auto new_xds_config = args.args.GetObjectRef<XdsConfig>();
if (new_xds_config == nullptr) {
// Should never happen.
absl::Status status = absl::InternalError(

@ -0,0 +1,96 @@
//
// Copyright 2019 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "src/core/resolver/xds/xds_config.h"
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "absl/strings/str_cat.h"
#include "absl/strings/str_join.h"
#include "src/core/lib/gprpp/match.h"
namespace grpc_core {
//
// XdsConfig::ClusterConfig
//
XdsConfig::ClusterConfig::ClusterConfig(
std::shared_ptr<const XdsClusterResource> cluster,
std::shared_ptr<const XdsEndpointResource> endpoints,
std::string resolution_note)
: cluster(std::move(cluster)),
children(absl::in_place_type_t<EndpointConfig>(), std::move(endpoints),
std::move(resolution_note)) {}
XdsConfig::ClusterConfig::ClusterConfig(
std::shared_ptr<const XdsClusterResource> cluster,
std::vector<absl::string_view> leaf_clusters)
: cluster(std::move(cluster)),
children(absl::in_place_type_t<AggregateConfig>(),
std::move(leaf_clusters)) {}
//
// XdsConfig
//
std::string XdsConfig::ToString() const {
std::vector<std::string> parts = {
"{\n listener: {", listener->ToString(),
"}\n route_config: {", route_config->ToString(),
"}\n virtual_host: {", virtual_host->ToString(),
"}\n clusters: {\n"};
for (const auto& p : clusters) {
parts.push_back(absl::StrCat(" \"", p.first, "\": "));
if (!p.second.ok()) {
parts.push_back(p.second.status().ToString());
parts.push_back("\n");
} else {
parts.push_back(
absl::StrCat(" {\n"
" cluster: {",
p.second->cluster->ToString(), "}\n"));
Match(
p.second->children,
[&](const ClusterConfig::EndpointConfig& endpoint_config) {
parts.push_back(
absl::StrCat(" endpoints: {",
endpoint_config.endpoints == nullptr
? "<null>"
: endpoint_config.endpoints->ToString(),
"}\n"
" resolution_note: \"",
endpoint_config.resolution_note, "\"\n"));
},
[&](const ClusterConfig::AggregateConfig& aggregate_config) {
parts.push_back(absl::StrCat(
" leaf_clusters: [",
absl::StrJoin(aggregate_config.leaf_clusters, ", "), "]\n"));
});
parts.push_back(
" }\n"
" ]\n");
}
}
parts.push_back(" }\n}");
return absl::StrJoin(parts, "");
}
} // namespace grpc_core

@ -0,0 +1,109 @@
//
// Copyright 2019 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef GRPC_SRC_CORE_RESOLVER_XDS_XDS_CONFIG_H
#define GRPC_SRC_CORE_RESOLVER_XDS_XDS_CONFIG_H
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "absl/container/flat_hash_map.h"
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
#include "absl/types/variant.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/xds/grpc/xds_cluster.h"
#include "src/core/xds/grpc/xds_endpoint.h"
#include "src/core/xds/grpc/xds_listener.h"
#include "src/core/xds/grpc/xds_route_config.h"
namespace grpc_core {
// A complete gRPC client-side xDS config containing all necessary
// resources.
struct XdsConfig : public RefCounted<XdsConfig> {
// Listener resource. Always non-null.
std::shared_ptr<const XdsListenerResource> listener;
// RouteConfig resource. Will be populated even if RouteConfig is
// inlined into the Listener resource.
std::shared_ptr<const XdsRouteConfigResource> route_config;
// Virtual host. Points into route_config. Will always be non-null.
const XdsRouteConfigResource::VirtualHost* virtual_host;
struct ClusterConfig {
// Cluster resource. Always non-null.
std::shared_ptr<const XdsClusterResource> cluster;
// Endpoint info for EDS and LOGICAL_DNS clusters. If there was an
// error, endpoints will be null and resolution_note will be set.
struct EndpointConfig {
std::shared_ptr<const XdsEndpointResource> endpoints;
std::string resolution_note;
EndpointConfig(std::shared_ptr<const XdsEndpointResource> endpoints,
std::string resolution_note)
: endpoints(std::move(endpoints)),
resolution_note(std::move(resolution_note)) {}
bool operator==(const EndpointConfig& other) const {
return endpoints == other.endpoints &&
resolution_note == other.resolution_note;
}
};
// The list of leaf clusters for an aggregate cluster.
struct AggregateConfig {
std::vector<absl::string_view> leaf_clusters;
explicit AggregateConfig(std::vector<absl::string_view> leaf_clusters)
: leaf_clusters(std::move(leaf_clusters)) {}
bool operator==(const AggregateConfig& other) const {
return leaf_clusters == other.leaf_clusters;
}
};
absl::variant<EndpointConfig, AggregateConfig> children;
// Ctor for leaf clusters.
ClusterConfig(std::shared_ptr<const XdsClusterResource> cluster,
std::shared_ptr<const XdsEndpointResource> endpoints,
std::string resolution_note);
// Ctor for aggregate clusters.
ClusterConfig(std::shared_ptr<const XdsClusterResource> cluster,
std::vector<absl::string_view> leaf_clusters);
bool operator==(const ClusterConfig& other) const {
return cluster == other.cluster && children == other.children;
}
};
// Cluster map. A cluster will have a non-OK status if either
// (a) there was an error and we did not already have a valid
// resource or (b) the resource does not exist.
absl::flat_hash_map<std::string, absl::StatusOr<ClusterConfig>> clusters;
std::string ToString() const;
static absl::string_view ChannelArgName() {
return GRPC_ARG_NO_SUBCHANNEL_PREFIX "xds_config";
}
static int ChannelArgsCompare(const XdsConfig* a, const XdsConfig* b) {
return QsortCompare(a, b);
}
static constexpr bool ChannelArgUseConstPtr() { return true; }
};
} // namespace grpc_core
#endif // GRPC_SRC_CORE_RESOLVER_XDS_XDS_CONFIG_H

@ -43,71 +43,6 @@ constexpr int kMaxXdsAggregateClusterRecursionDepth = 16;
} // namespace
//
// XdsDependencyManager::XdsConfig::ClusterConfig
//
XdsDependencyManager::XdsConfig::ClusterConfig::ClusterConfig(
std::shared_ptr<const XdsClusterResource> cluster,
std::shared_ptr<const XdsEndpointResource> endpoints,
std::string resolution_note)
: cluster(std::move(cluster)),
children(absl::in_place_type_t<EndpointConfig>(), std::move(endpoints),
std::move(resolution_note)) {}
XdsDependencyManager::XdsConfig::ClusterConfig::ClusterConfig(
std::shared_ptr<const XdsClusterResource> cluster,
std::vector<absl::string_view> leaf_clusters)
: cluster(std::move(cluster)),
children(absl::in_place_type_t<AggregateConfig>(),
std::move(leaf_clusters)) {}
//
// XdsDependencyManager::XdsConfig
//
std::string XdsDependencyManager::XdsConfig::ToString() const {
std::vector<std::string> parts = {
"{\n listener: {", listener->ToString(),
"}\n route_config: {", route_config->ToString(),
"}\n virtual_host: {", virtual_host->ToString(),
"}\n clusters: {\n"};
for (const auto& p : clusters) {
parts.push_back(absl::StrCat(" \"", p.first, "\": "));
if (!p.second.ok()) {
parts.push_back(p.second.status().ToString());
parts.push_back("\n");
} else {
parts.push_back(
absl::StrCat(" {\n"
" cluster: {",
p.second->cluster->ToString(), "}\n"));
Match(
p.second->children,
[&](const ClusterConfig::EndpointConfig& endpoint_config) {
parts.push_back(
absl::StrCat(" endpoints: {",
endpoint_config.endpoints == nullptr
? "<null>"
: endpoint_config.endpoints->ToString(),
"}\n"
" resolution_note: \"",
endpoint_config.resolution_note, "\"\n"));
},
[&](const ClusterConfig::AggregateConfig& aggregate_config) {
parts.push_back(absl::StrCat(
" leaf_clusters: [",
absl::StrJoin(aggregate_config.leaf_clusters, ", "), "]\n"));
});
parts.push_back(
" }\n"
" ]\n");
}
}
parts.push_back(" }\n}");
return absl::StrJoin(parts, "");
}
//
// XdsDependencyManager::ListenerWatcher
//

@ -21,10 +21,9 @@
#include "absl/container/flat_hash_set.h"
#include "absl/strings/string_view.h"
#include <grpc/support/port_platform.h>
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/resolver/resolver.h"
#include "src/core/resolver/xds/xds_config.h"
#include "src/core/xds/grpc/xds_client_grpc.h"
#include "src/core/xds/grpc/xds_cluster.h"
#include "src/core/xds/grpc/xds_endpoint.h"
@ -38,73 +37,6 @@ namespace grpc_core {
class XdsDependencyManager final : public RefCounted<XdsDependencyManager>,
public Orphanable {
public:
struct XdsConfig : public RefCounted<XdsConfig> {
// Listener resource. Always non-null.
std::shared_ptr<const XdsListenerResource> listener;
// RouteConfig resource. Will be populated even if RouteConfig is
// inlined into the Listener resource.
std::shared_ptr<const XdsRouteConfigResource> route_config;
// Virtual host. Points into route_config. Will always be non-null.
const XdsRouteConfigResource::VirtualHost* virtual_host;
struct ClusterConfig {
// Cluster resource. Always non-null.
std::shared_ptr<const XdsClusterResource> cluster;
// Endpoint info for EDS and LOGICAL_DNS clusters. If there was an
// error, endpoints will be null and resolution_note will be set.
struct EndpointConfig {
std::shared_ptr<const XdsEndpointResource> endpoints;
std::string resolution_note;
EndpointConfig(std::shared_ptr<const XdsEndpointResource> endpoints,
std::string resolution_note)
: endpoints(std::move(endpoints)),
resolution_note(std::move(resolution_note)) {}
bool operator==(const EndpointConfig& other) const {
return endpoints == other.endpoints &&
resolution_note == other.resolution_note;
}
};
// The list of leaf clusters for an aggregate cluster.
struct AggregateConfig {
std::vector<absl::string_view> leaf_clusters;
explicit AggregateConfig(std::vector<absl::string_view> leaf_clusters)
: leaf_clusters(std::move(leaf_clusters)) {}
bool operator==(const AggregateConfig& other) const {
return leaf_clusters == other.leaf_clusters;
}
};
absl::variant<EndpointConfig, AggregateConfig> children;
// Ctor for leaf clusters.
ClusterConfig(std::shared_ptr<const XdsClusterResource> cluster,
std::shared_ptr<const XdsEndpointResource> endpoints,
std::string resolution_note);
// Ctor for aggregate clusters.
ClusterConfig(std::shared_ptr<const XdsClusterResource> cluster,
std::vector<absl::string_view> leaf_clusters);
bool operator==(const ClusterConfig& other) const {
return cluster == other.cluster && children == other.children;
}
};
// Cluster map. A cluster will have a non-OK status if either
// (a) there was an error and we did not already have a valid
// resource or (b) the resource does not exist.
absl::flat_hash_map<std::string, absl::StatusOr<ClusterConfig>> clusters;
std::string ToString() const;
static absl::string_view ChannelArgName() {
return GRPC_ARG_NO_SUBCHANNEL_PREFIX "xds_config";
}
static int ChannelArgsCompare(const XdsConfig* a, const XdsConfig* b) {
return QsortCompare(a, b);
}
static constexpr bool ChannelArgUseConstPtr() { return true; }
};
class Watcher {
public:
virtual ~Watcher() = default;

@ -139,8 +139,7 @@ class XdsResolver final : public Resolver {
explicit XdsWatcher(RefCountedPtr<XdsResolver> resolver)
: resolver_(std::move(resolver)) {}
void OnUpdate(
RefCountedPtr<const XdsDependencyManager::XdsConfig> config) override {
void OnUpdate(RefCountedPtr<const XdsConfig> config) override {
resolver_->OnUpdate(std::move(config));
}
@ -363,7 +362,7 @@ class XdsResolver final : public Resolver {
return it->second->Ref();
}
void OnUpdate(RefCountedPtr<const XdsDependencyManager::XdsConfig> config);
void OnUpdate(RefCountedPtr<const XdsConfig> config);
void OnError(absl::string_view context, absl::Status status);
void OnResourceDoesNotExist(std::string context);
@ -382,7 +381,7 @@ class XdsResolver final : public Resolver {
const uint64_t channel_id_;
OrphanablePtr<XdsDependencyManager> dependency_mgr_;
RefCountedPtr<const XdsDependencyManager::XdsConfig> current_config_;
RefCountedPtr<const XdsConfig> current_config_;
std::map<absl::string_view, WeakRefCountedPtr<ClusterRef>> cluster_ref_map_;
};
@ -976,8 +975,7 @@ void XdsResolver::ShutdownLocked() {
}
}
void XdsResolver::OnUpdate(
RefCountedPtr<const XdsDependencyManager::XdsConfig> config) {
void XdsResolver::OnUpdate(RefCountedPtr<const XdsConfig> config) {
GRPC_TRACE_LOG(xds_resolver, INFO)
<< "[xds_resolver " << this << "] received updated xDS config";
if (xds_client_ == nullptr) return;

@ -753,6 +753,7 @@ CORE_SOURCE_FILES = [
'src/core/resolver/resolver.cc',
'src/core/resolver/resolver_registry.cc',
'src/core/resolver/sockaddr/sockaddr_resolver.cc',
'src/core/resolver/xds/xds_config.cc',
'src/core/resolver/xds/xds_dependency_manager.cc',
'src/core/resolver/xds/xds_resolver.cc',
'src/core/server/server.cc',

@ -43,7 +43,7 @@
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/load_balancing/lb_policy.h"
#include "src/core/resolver/endpoint_addresses.h"
#include "src/core/resolver/xds/xds_dependency_manager.h"
#include "src/core/resolver/xds/xds_config.h"
#include "src/core/util/json/json.h"
#include "src/core/xds/grpc/xds_health_status.h"
#include "test/core/load_balancing/lb_policy_test_lib.h"
@ -57,7 +57,7 @@ class XdsOverrideHostTest : public LoadBalancingPolicyTest {
XdsOverrideHostTest()
: LoadBalancingPolicyTest("xds_override_host_experimental") {}
static RefCountedPtr<const XdsDependencyManager::XdsConfig> MakeXdsConfig(
static RefCountedPtr<const XdsConfig> MakeXdsConfig(
absl::Span<const absl::string_view> override_host_statuses = {"UNKNOWN",
"HEALTHY"},
absl::optional<Duration> connection_idle_timeout = absl::nullopt,
@ -70,7 +70,7 @@ class XdsOverrideHostTest : public LoadBalancingPolicyTest {
if (connection_idle_timeout.has_value()) {
cluster_resource->connection_idle_timeout = *connection_idle_timeout;
}
auto xds_config = MakeRefCounted<XdsDependencyManager::XdsConfig>();
auto xds_config = MakeRefCounted<XdsConfig>();
xds_config->clusters[std::move(cluster_name)].emplace(
std::move(cluster_resource), nullptr, "");
return xds_config;

@ -2820,6 +2820,8 @@ src/core/resolver/resolver_registry.cc \
src/core/resolver/resolver_registry.h \
src/core/resolver/server_address.h \
src/core/resolver/sockaddr/sockaddr_resolver.cc \
src/core/resolver/xds/xds_config.cc \
src/core/resolver/xds/xds_config.h \
src/core/resolver/xds/xds_dependency_manager.cc \
src/core/resolver/xds/xds_dependency_manager.h \
src/core/resolver/xds/xds_resolver.cc \

@ -2597,6 +2597,8 @@ src/core/resolver/resolver_registry.h \
src/core/resolver/server_address.h \
src/core/resolver/sockaddr/README.md \
src/core/resolver/sockaddr/sockaddr_resolver.cc \
src/core/resolver/xds/xds_config.cc \
src/core/resolver/xds/xds_config.h \
src/core/resolver/xds/xds_dependency_manager.cc \
src/core/resolver/xds/xds_dependency_manager.h \
src/core/resolver/xds/xds_resolver.cc \

Loading…
Cancel
Save