diff --git a/BUILD b/BUILD
index 614aa9db96b..945acd00260 100644
--- a/BUILD
+++ b/BUILD
@@ -2892,7 +2892,6 @@ grpc_cc_library(
"absl/status",
"absl/status:statusor",
"absl/strings",
- "absl/strings:str_format",
],
language = "c++",
visibility = ["@grpc:client_channel"],
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 79256f992b8..3f5b7a2193f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1707,7 +1707,6 @@ add_library(grpc
src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc
src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc
src/core/ext/filters/client_channel/lb_policy/xds/cds.cc
- src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc
src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc
src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc
src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc
diff --git a/Makefile b/Makefile
index 4c1a32175c8..fe3213dee24 100644
--- a/Makefile
+++ b/Makefile
@@ -997,7 +997,6 @@ LIBGRPC_SRC = \
src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc \
src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc \
src/core/ext/filters/client_channel/lb_policy/xds/cds.cc \
- src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc \
src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc \
src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc \
src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc \
@@ -3050,7 +3049,6 @@ ifneq ($(OPENSSL_DEP),)
# otherwise parallel compilation will fail if a source is compiled first.
src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc: $(OPENSSL_DEP)
src/core/ext/filters/client_channel/lb_policy/xds/cds.cc: $(OPENSSL_DEP)
-src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc: $(OPENSSL_DEP)
src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc: $(OPENSSL_DEP)
src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc: $(OPENSSL_DEP)
src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc: $(OPENSSL_DEP)
diff --git a/Package.swift b/Package.swift
index c3e971d3d12..19057f6fe4a 100644
--- a/Package.swift
+++ b/Package.swift
@@ -178,8 +178,6 @@ let package = Package(
"src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc",
"src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc",
"src/core/ext/filters/client_channel/lb_policy/xds/cds.cc",
- "src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc",
- "src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h",
"src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h",
"src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc",
"src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc",
diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml
index 23eaeed3ed8..d96032cc360 100644
--- a/build_autogenerated.yaml
+++ b/build_autogenerated.yaml
@@ -244,7 +244,6 @@ libs:
- src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h
- src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
- src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.h
- - src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h
- src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h
- src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.h
- src/core/ext/filters/client_channel/local_subchannel_pool.h
@@ -1052,7 +1051,6 @@ libs:
- src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc
- src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc
- src/core/ext/filters/client_channel/lb_policy/xds/cds.cc
- - src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc
- src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc
- src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc
- src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc
diff --git a/config.m4 b/config.m4
index 22bc192d4b0..f9ee388bae4 100644
--- a/config.m4
+++ b/config.m4
@@ -76,7 +76,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc \
src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc \
src/core/ext/filters/client_channel/lb_policy/xds/cds.cc \
- src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc \
src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc \
src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc \
src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc \
diff --git a/config.w32 b/config.w32
index a21cb6d4237..f8756ae7c58 100644
--- a/config.w32
+++ b/config.w32
@@ -41,7 +41,6 @@ if (PHP_GRPC != "no") {
"src\\core\\ext\\filters\\client_channel\\lb_policy\\weighted_round_robin\\weighted_round_robin.cc " +
"src\\core\\ext\\filters\\client_channel\\lb_policy\\weighted_target\\weighted_target.cc " +
"src\\core\\ext\\filters\\client_channel\\lb_policy\\xds\\cds.cc " +
- "src\\core\\ext\\filters\\client_channel\\lb_policy\\xds\\xds_attributes.cc " +
"src\\core\\ext\\filters\\client_channel\\lb_policy\\xds\\xds_cluster_impl.cc " +
"src\\core\\ext\\filters\\client_channel\\lb_policy\\xds\\xds_cluster_manager.cc " +
"src\\core\\ext\\filters\\client_channel\\lb_policy\\xds\\xds_cluster_resolver.cc " +
diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec
index 1ba1875284a..d342da2858a 100644
--- a/gRPC-C++.podspec
+++ b/gRPC-C++.podspec
@@ -276,7 +276,6 @@ Pod::Spec.new do |s|
'src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h',
'src/core/ext/filters/client_channel/lb_policy/subchannel_list.h',
'src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.h',
- 'src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h',
'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h',
'src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.h',
'src/core/ext/filters/client_channel/local_subchannel_pool.h',
@@ -1338,7 +1337,6 @@ Pod::Spec.new do |s|
'src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h',
'src/core/ext/filters/client_channel/lb_policy/subchannel_list.h',
'src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.h',
- 'src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h',
'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h',
'src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.h',
'src/core/ext/filters/client_channel/local_subchannel_pool.h',
diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec
index 5fe96406928..1e24a14310c 100644
--- a/gRPC-Core.podspec
+++ b/gRPC-Core.podspec
@@ -279,8 +279,6 @@ Pod::Spec.new do |s|
'src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc',
'src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc',
'src/core/ext/filters/client_channel/lb_policy/xds/cds.cc',
- 'src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc',
- 'src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h',
'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h',
'src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc',
'src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc',
@@ -2088,7 +2086,6 @@ Pod::Spec.new do |s|
'src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h',
'src/core/ext/filters/client_channel/lb_policy/subchannel_list.h',
'src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.h',
- 'src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h',
'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h',
'src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.h',
'src/core/ext/filters/client_channel/local_subchannel_pool.h',
diff --git a/grpc.gemspec b/grpc.gemspec
index 1cb1cef491a..3c30d689e33 100644
--- a/grpc.gemspec
+++ b/grpc.gemspec
@@ -184,8 +184,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/cds.cc )
- s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc )
- s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc )
s.files += %w( src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc )
diff --git a/grpc.gyp b/grpc.gyp
index d6791097df6..1a056667251 100644
--- a/grpc.gyp
+++ b/grpc.gyp
@@ -301,7 +301,6 @@
'src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc',
'src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc',
'src/core/ext/filters/client_channel/lb_policy/xds/cds.cc',
- 'src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc',
'src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc',
'src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc',
'src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc',
diff --git a/package.xml b/package.xml
index 3cfcec2c46e..ace800d863f 100644
--- a/package.xml
+++ b/package.xml
@@ -166,8 +166,6 @@
-
-
diff --git a/src/core/BUILD b/src/core/BUILD
index 530241727de..5167903f3d2 100644
--- a/src/core/BUILD
+++ b/src/core/BUILD
@@ -4349,24 +4349,9 @@ grpc_cc_library(
"ext/filters/client_channel/lb_policy/xds/xds_channel_args.h",
],
language = "c++",
-)
-
-grpc_cc_library(
- name = "grpc_lb_xds_attributes",
- srcs = [
- "ext/filters/client_channel/lb_policy/xds/xds_attributes.cc",
- ],
- hdrs = [
- "ext/filters/client_channel/lb_policy/xds/xds_attributes.h",
- ],
- external_deps = ["absl/strings"],
- language = "c++",
deps = [
- "useful",
"//:gpr_platform",
- "//:ref_counted_ptr",
"//:server_address",
- "//:xds_client",
],
)
@@ -4386,7 +4371,6 @@ grpc_cc_library(
"channel_args",
"delegating_helper",
"grpc_lb_address_filtering",
- "grpc_lb_xds_attributes",
"grpc_lb_xds_channel_args",
"grpc_xds_client",
"json",
@@ -4432,7 +4416,6 @@ grpc_cc_library(
"channel_args",
"delegating_helper",
"grpc_backend_metric_data",
- "grpc_lb_xds_attributes",
"grpc_lb_xds_channel_args",
"grpc_xds_client",
"json",
@@ -4507,12 +4490,13 @@ grpc_cc_library(
"absl/status",
"absl/status:statusor",
"absl/strings",
+ "absl/types:optional",
],
language = "c++",
deps = [
"channel_args",
"delegating_helper",
- "grpc_lb_xds_attributes",
+ "grpc_lb_xds_channel_args",
"json",
"json_args",
"json_object_loader",
@@ -4548,7 +4532,10 @@ grpc_cc_library(
],
language = "c++",
deps = [
+ "channel_args",
+ "ref_counted",
"//:gpr_platform",
+ "//:ref_counted_ptr",
"//:server_address",
],
)
diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc
index 2e712e91187..afbc704c117 100644
--- a/src/core/ext/filters/client_channel/client_channel.cc
+++ b/src/core/ext/filters/client_channel/client_channel.cc
@@ -1163,7 +1163,9 @@ ChannelArgs ClientChannel::MakeSubchannelArgs(
// uniqueness.
.Remove(GRPC_ARG_HEALTH_CHECK_SERVICE_NAME)
.Remove(GRPC_ARG_INHIBIT_HEALTH_CHECKING)
- .Remove(GRPC_ARG_CHANNELZ_CHANNEL_NODE);
+ .Remove(GRPC_ARG_CHANNELZ_CHANNEL_NODE)
+ // Remove all keys with the no-subchannel prefix.
+ .RemoveAllKeysWithPrefix(GRPC_ARG_NO_SUBCHANNEL_PREFIX);
}
void ClientChannel::ReprocessQueuedResolverCalls() {
diff --git a/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc b/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc
index e7893d6ff56..0ddaaf0f523 100644
--- a/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc
@@ -23,53 +23,24 @@
#include
#include
-#include "absl/strings/str_cat.h"
-#include "absl/strings/str_join.h"
-
-#define GRPC_ARG_HIERARCHICAL_PATH "grpc.internal.address.hierarchical_path"
+#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/gprpp/ref_counted_ptr.h"
namespace grpc_core {
-const char* kHierarchicalPathAttributeKey = "hierarchical_path";
-
-namespace {
-
-class HierarchicalPathAttribute : public ServerAddress::AttributeInterface {
- public:
- explicit HierarchicalPathAttribute(std::vector path)
- : path_(std::move(path)) {}
-
- std::unique_ptr Copy() const override {
- return std::make_unique(path_);
- }
-
- int Cmp(const AttributeInterface* other) const override {
- const std::vector& other_path =
- static_cast(other)->path_;
- for (size_t i = 0; i < path_.size(); ++i) {
- if (other_path.size() == i) return 1;
- int r = path_[i].compare(other_path[i]);
- if (r != 0) return r;
- }
- if (other_path.size() > path_.size()) return -1;
- return 0;
- }
+absl::string_view HierarchicalPathArg::ChannelArgName() {
+ return GRPC_ARG_NO_SUBCHANNEL_PREFIX "address.hierarchical_path";
+}
- std::string ToString() const override {
- return absl::StrCat("[", absl::StrJoin(path_, ", "), "]");
+int HierarchicalPathArg::ChannelArgsCompare(const HierarchicalPathArg* a,
+ const HierarchicalPathArg* b) {
+ for (size_t i = 0; i < a->path_.size(); ++i) {
+ if (b->path_.size() == i) return 1;
+ int r = a->path_[i].compare(b->path_[i]);
+ if (r != 0) return r;
}
-
- const std::vector& path() const { return path_; }
-
- private:
- std::vector path_;
-};
-
-} // namespace
-
-std::unique_ptr
-MakeHierarchicalPathAttribute(std::vector path) {
- return std::make_unique(std::move(path));
+ if (b->path_.size() > a->path_.size()) return -1;
+ return 0;
}
absl::StatusOr MakeHierarchicalAddressMap(
@@ -77,22 +48,20 @@ absl::StatusOr MakeHierarchicalAddressMap(
if (!addresses.ok()) return addresses.status();
HierarchicalAddressMap result;
for (const ServerAddress& address : *addresses) {
- const HierarchicalPathAttribute* path_attribute =
- static_cast(
- address.GetAttribute(kHierarchicalPathAttributeKey));
- if (path_attribute == nullptr) continue;
- const std::vector& path = path_attribute->path();
+ const auto* path_arg = address.args().GetObject();
+ if (path_arg == nullptr) continue;
+ const std::vector& path = path_arg->path();
auto it = path.begin();
+ if (it == path.end()) continue;
ServerAddressList& target_list = result[*it];
- std::unique_ptr new_attribute;
+ ChannelArgs args = address.args();
++it;
if (it != path.end()) {
std::vector remaining_path(it, path.end());
- new_attribute = std::make_unique(
- std::move(remaining_path));
+ args = args.SetObject(
+ MakeRefCounted(std::move(remaining_path)));
}
- target_list.emplace_back(address.WithAttribute(
- kHierarchicalPathAttributeKey, std::move(new_attribute)));
+ target_list.emplace_back(address.address(), args);
}
return result;
}
diff --git a/src/core/ext/filters/client_channel/lb_policy/address_filtering.h b/src/core/ext/filters/client_channel/lb_policy/address_filtering.h
index 771ef6fc2f2..2e4aa2017d4 100644
--- a/src/core/ext/filters/client_channel/lb_policy/address_filtering.h
+++ b/src/core/ext/filters/client_channel/lb_policy/address_filtering.h
@@ -20,12 +20,14 @@
#include
#include