xds_cluster.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_XDS_XDS_CLUSTER_H
18 #define GRPC_CORE_EXT_XDS_XDS_CLUSTER_H
19 
21 
22 #include <stdint.h>
23 
24 #include <algorithm>
25 #include <memory>
26 #include <string>
27 #include <vector>
28 
29 #include "absl/status/statusor.h"
30 #include "absl/strings/string_view.h"
31 #include "absl/types/optional.h"
35 #include "upb/def.h"
36 
42 
43 namespace grpc_core {
44 
48  // For cluster type EDS.
49  // The name to use in the EDS request.
50  // If empty, the cluster name will be used.
52  // For cluster type LOGICAL_DNS.
53  // The hostname to lookup in DNS.
55  // For cluster type AGGREGATE.
56  // The prioritized list of cluster names.
57  std::vector<std::string> prioritized_cluster_names;
58 
59  // Tls Context used by clients
61 
62  // The LRS server to use for load reporting.
63  // If not set, load reporting will be disabled.
65 
66  // The LB policy to use (e.g., "ROUND_ROBIN" or "RING_HASH").
68  // Used for RING_HASH LB policy only.
71  // Maximum number of outstanding requests can be made to the upstream
72  // cluster.
74 
76 
77  bool operator==(const XdsClusterResource& other) const {
78  return cluster_type == other.cluster_type &&
80  dns_hostname == other.dns_hostname &&
84  lb_policy == other.lb_policy &&
85  min_ring_size == other.min_ring_size &&
86  max_ring_size == other.max_ring_size &&
88  }
89 
90  std::string ToString() const;
91 };
92 
94  : public XdsResourceTypeImpl<XdsClusterResourceType, XdsClusterResource> {
95  public:
96  absl::string_view type_url() const override {
97  return "envoy.config.cluster.v3.Cluster";
98  }
99  absl::string_view v2_type_url() const override {
100  return "envoy.api.v2.Cluster";
101  }
102 
104  absl::string_view serialized_resource,
105  bool is_v2) const override;
106 
107  bool AllResourcesRequiredInSotW() const override { return true; }
108 
109  void InitUpbSymtab(upb_DefPool* symtab) const override {
113  symtab);
114  }
115 };
116 
117 } // namespace grpc_core
118 
119 #endif // GRPC_CORE_EXT_XDS_XDS_CLUSTER_H
cluster.upbdefs.h
grpc_core::XdsClusterResourceType
Definition: xds_cluster.h:93
grpc_core::XdsEncodingContext
Definition: upb_utils.h:39
grpc_core
Definition: call_metric_recorder.h:31
absl::string_view
Definition: abseil-cpp/absl/strings/string_view.h:167
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
grpc_core::XdsClusterResource::eds_service_name
std::string eds_service_name
Definition: xds_cluster.h:51
grpc_core::XdsClusterResource::ToString
std::string ToString() const
Definition: xds_cluster.cc:63
grpc_core::XdsClusterResource::outlier_detection
absl::optional< OutlierDetectionConfig > outlier_detection
Definition: xds_cluster.h:75
grpc_core::XdsClusterResourceType::AllResourcesRequiredInSotW
bool AllResourcesRequiredInSotW() const override
Definition: xds_cluster.h:107
xds_resource_type_impl.h
grpc_core::XdsClusterResource::EDS
@ EDS
Definition: xds_cluster.h:46
grpc_core::XdsClusterResource::max_ring_size
uint64_t max_ring_size
Definition: xds_cluster.h:70
grpc_core::XdsClusterResource::lb_policy
std::string lb_policy
Definition: xds_cluster.h:67
grpc_core::XdsClusterResource::cluster_type
ClusterType cluster_type
Definition: xds_cluster.h:47
envoy_extensions_clusters_aggregate_v3_ClusterConfig_getmsgdef
const UPB_INLINE upb_MessageDef * envoy_extensions_clusters_aggregate_v3_ClusterConfig_getmsgdef(upb_DefPool *s)
Definition: extensions/clusters/aggregate/v3/cluster.upbdefs.h:24
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
grpc_core::XdsClusterResource::common_tls_context
CommonTlsContext common_tls_context
Definition: xds_cluster.h:60
grpc_core::XdsClusterResource::dns_hostname
std::string dns_hostname
Definition: xds_cluster.h:54
grpc_core::XdsResourceTypeImpl
Definition: xds_resource_type_impl.h:34
grpc_core::XdsClusterResource::max_concurrent_requests
uint32_t max_concurrent_requests
Definition: xds_cluster.h:73
xds_common_types.h
cluster.upbdefs.h
xds_bootstrap.h
grpc_core::XdsClusterResource
Definition: xds_cluster.h:45
uint64_t
unsigned __int64 uint64_t
Definition: stdint-msvc2008.h:90
grpc_core::XdsClusterResource::prioritized_cluster_names
std::vector< std::string > prioritized_cluster_names
Definition: xds_cluster.h:57
absl::optional
Definition: abseil-cpp/absl/types/internal/optional.h:61
grpc_core::XdsClusterResource::ClusterType
ClusterType
Definition: xds_cluster.h:46
envoy_config_cluster_v3_Cluster_getmsgdef
const UPB_INLINE upb_MessageDef * envoy_config_cluster_v3_Cluster_getmsgdef(upb_DefPool *s)
Definition: config/cluster/v3/cluster.upbdefs.h:29
grpc_core::XdsClusterResourceType::type_url
absl::string_view type_url() const override
Definition: xds_cluster.h:96
stdint.h
grpc_core::XdsClusterResourceType::Decode
absl::StatusOr< DecodeResult > Decode(const XdsEncodingContext &context, absl::string_view serialized_resource, bool is_v2) const override
Definition: xds_cluster.cc:519
symtab
upb_symtab * symtab
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:774
grpc_core::XdsClusterResource::lrs_load_reporting_server
absl::optional< XdsBootstrap::XdsServer > lrs_load_reporting_server
Definition: xds_cluster.h:64
grpc_core::XdsClusterResource::operator==
bool operator==(const XdsClusterResource &other) const
Definition: xds_cluster.h:77
grpc_core::XdsClusterResource::min_ring_size
uint64_t min_ring_size
Definition: xds_cluster.h:69
grpc_core::CommonTlsContext
Definition: xds_common_types.h:45
def.h
grpc_core::XdsClusterResource::LOGICAL_DNS
@ LOGICAL_DNS
Definition: xds_cluster.h:46
grpc_core::XdsClusterResourceType::InitUpbSymtab
void InitUpbSymtab(upb_DefPool *symtab) const override
Definition: xds_cluster.h:109
tls.upbdefs.h
envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext_getmsgdef
const UPB_INLINE upb_MessageDef * envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext_getmsgdef(upb_DefPool *s)
Definition: tls.upbdefs.h:24
context
grpc::ClientContext context
Definition: istio_echo_server_lib.cc:61
absl::StatusOr
Definition: abseil-cpp/absl/status/statusor.h:187
upb_utils.h
upb_DefPool
Definition: upb/upb/def.c:217
grpc_core::XdsClusterResourceType::v2_type_url
absl::string_view v2_type_url() const override
Definition: xds_cluster.h:99
grpc_core::XdsClusterResource::AGGREGATE
@ AGGREGATE
Definition: xds_cluster.h:46
outlier_detection.h
port_platform.h


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