xds.h
Go to the documentation of this file.
1 //
2 // Copyright 2018 gRPC authors.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_XDS_XDS_H
18 #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_XDS_XDS_H
19 
21 
22 #include <memory>
23 #include <string>
24 #include <utility>
25 
26 #include "absl/memory/memory.h"
27 
31 
32 namespace grpc_core {
33 
34 // Defined in the EDS policy.
35 extern const char* kXdsLocalityNameAttributeKey;
36 
38  public:
41 
43  return locality_name_;
44  }
45 
46  std::unique_ptr<AttributeInterface> Copy() const override {
47  return absl::make_unique<XdsLocalityAttribute>(locality_name_->Ref());
48  }
49 
50  int Cmp(const AttributeInterface* other) const override {
51  const auto* other_locality_attr =
52  static_cast<const XdsLocalityAttribute*>(other);
53  return locality_name_->Compare(*other_locality_attr->locality_name_);
54  }
55 
56  std::string ToString() const override {
57  return locality_name_->AsHumanReadableString();
58  }
59 
60  private:
62 };
63 
64 } // namespace grpc_core
65 
66 #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_XDS_XDS_H */
grpc_core::XdsLocalityAttribute::locality_name_
RefCountedPtr< XdsLocalityName > locality_name_
Definition: xds.h:61
xds_client_stats.h
grpc_core
Definition: call_metric_recorder.h:31
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
grpc_core::XdsLocalityAttribute::locality_name
RefCountedPtr< XdsLocalityName > locality_name() const
Definition: xds.h:42
grpc_core::RefCountedPtr
Definition: ref_counted_ptr.h:35
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
grpc_core::XdsLocalityAttribute
Definition: xds.h:37
grpc_core::XdsLocalityAttribute::XdsLocalityAttribute
XdsLocalityAttribute(RefCountedPtr< XdsLocalityName > locality_name)
Definition: xds.h:39
server_address.h
grpc_core::XdsLocalityAttribute::Cmp
int Cmp(const AttributeInterface *other) const override
Definition: xds.h:50
grpc_core::XdsLocalityAttribute::Copy
std::unique_ptr< AttributeInterface > Copy() const override
Definition: xds.h:46
grpc_core::kXdsLocalityNameAttributeKey
const char * kXdsLocalityNameAttributeKey
Definition: xds_cluster_resolver.cc:81
grpc_core::ServerAddress::AttributeInterface
Definition: server_address.h:58
std
Definition: grpcpp/impl/codegen/async_unary_call.h:407
ref_counted_ptr.h
grpc_core::XdsLocalityAttribute::ToString
std::string ToString() const override
Definition: xds.h:56
port_platform.h


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:55