xds_cluster_manager.cc
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 
18 
19 #include <stddef.h>
20 
21 #include <algorithm>
22 #include <map>
23 #include <memory>
24 #include <set>
25 #include <string>
26 #include <utility>
27 #include <vector>
28 
29 #include "absl/memory/memory.h"
30 #include "absl/status/status.h"
31 #include "absl/status/statusor.h"
32 #include "absl/strings/str_cat.h"
33 #include "absl/strings/string_view.h"
34 
37 #include <grpc/support/log.h>
38 
59 #include "src/core/lib/json/json.h"
62 
63 #define GRPC_XDS_CLUSTER_MANAGER_CHILD_RETENTION_INTERVAL_MS (15 * 60 * 1000)
64 
65 namespace grpc_core {
66 
67 TraceFlag grpc_xds_cluster_manager_lb_trace(false, "xds_cluster_manager_lb");
68 
69 namespace {
70 
71 constexpr char kXdsClusterManager[] = "xds_cluster_manager_experimental";
72 
73 // Config for xds_cluster_manager LB policy.
74 class XdsClusterManagerLbConfig : public LoadBalancingPolicy::Config {
75  public:
76  using ClusterMap =
77  std::map<std::string, RefCountedPtr<LoadBalancingPolicy::Config>>;
78 
79  explicit XdsClusterManagerLbConfig(ClusterMap cluster_map)
80  : cluster_map_(std::move(cluster_map)) {}
81 
82  const char* name() const override { return kXdsClusterManager; }
83 
84  const ClusterMap& cluster_map() const { return cluster_map_; }
85 
86  private:
87  ClusterMap cluster_map_;
88 };
89 
90 // xds_cluster_manager LB policy.
91 class XdsClusterManagerLb : public LoadBalancingPolicy {
92  public:
93  explicit XdsClusterManagerLb(Args args);
94 
95  const char* name() const override { return kXdsClusterManager; }
96 
97  void UpdateLocked(UpdateArgs args) override;
98  void ExitIdleLocked() override;
99  void ResetBackoffLocked() override;
100 
101  private:
102  // A simple wrapper for ref-counting a picker from the child policy.
103  class ChildPickerWrapper : public RefCounted<ChildPickerWrapper> {
104  public:
105  ChildPickerWrapper(std::string name,
106  std::unique_ptr<SubchannelPicker> picker)
107  : name_(std::move(name)), picker_(std::move(picker)) {}
108  PickResult Pick(PickArgs args) { return picker_->Pick(args); }
109 
110  const std::string& name() const { return name_; }
111 
112  private:
114  std::unique_ptr<SubchannelPicker> picker_;
115  };
116 
117  // Picks a child using prefix or path matching and then delegates to that
118  // child's picker.
119  class ClusterPicker : public SubchannelPicker {
120  public:
121  // Maintains a map of cluster names to pickers.
122  using ClusterMap = std::map<absl::string_view /*cluster_name*/,
123  RefCountedPtr<ChildPickerWrapper>>;
124 
125  // It is required that the keys of cluster_map have to live at least as long
126  // as the ClusterPicker instance.
127  explicit ClusterPicker(ClusterMap cluster_map)
128  : cluster_map_(std::move(cluster_map)) {}
129 
130  PickResult Pick(PickArgs args) override;
131 
132  private:
133  ClusterMap cluster_map_;
134  };
135 
136  // Each ClusterChild holds a ref to its parent XdsClusterManagerLb.
137  class ClusterChild : public InternallyRefCounted<ClusterChild> {
138  public:
139  ClusterChild(RefCountedPtr<XdsClusterManagerLb> xds_cluster_manager_policy,
140  const std::string& name);
141  ~ClusterChild() override;
142 
143  void Orphan() override;
144 
145  void UpdateLocked(RefCountedPtr<LoadBalancingPolicy::Config> config,
146  const absl::StatusOr<ServerAddressList>& addresses,
147  const grpc_channel_args* args);
148  void ExitIdleLocked();
149  void ResetBackoffLocked();
150  void DeactivateLocked();
151 
152  grpc_connectivity_state connectivity_state() const {
153  return connectivity_state_;
154  }
155  RefCountedPtr<ChildPickerWrapper> picker_wrapper() const {
156  return picker_wrapper_;
157  }
158 
159  private:
160  class Helper : public ChannelControlHelper {
161  public:
162  explicit Helper(RefCountedPtr<ClusterChild> xds_cluster_manager_child)
163  : xds_cluster_manager_child_(std::move(xds_cluster_manager_child)) {}
164 
165  ~Helper() override {
167  }
168 
169  RefCountedPtr<SubchannelInterface> CreateSubchannel(
170  ServerAddress address, const grpc_channel_args& args) override;
171  void UpdateState(grpc_connectivity_state state,
172  const absl::Status& status,
173  std::unique_ptr<SubchannelPicker> picker) override;
174  void RequestReresolution() override;
175  absl::string_view GetAuthority() override;
176  void AddTraceEvent(TraceSeverity severity,
177  absl::string_view message) override;
178 
179  private:
180  RefCountedPtr<ClusterChild> xds_cluster_manager_child_;
181  };
182 
183  // Methods for dealing with the child policy.
184  OrphanablePtr<LoadBalancingPolicy> CreateChildPolicyLocked(
185  const grpc_channel_args* args);
186 
187  static void OnDelayedRemovalTimer(void* arg, grpc_error_handle error);
188  void OnDelayedRemovalTimerLocked(grpc_error_handle error);
189 
190  // The owning LB policy.
191  RefCountedPtr<XdsClusterManagerLb> xds_cluster_manager_policy_;
192 
193  // Points to the corresponding key in children map.
194  const std::string name_;
195 
196  OrphanablePtr<LoadBalancingPolicy> child_policy_;
197 
198  RefCountedPtr<ChildPickerWrapper> picker_wrapper_;
200 
201  // States for delayed removal.
205  bool shutdown_ = false;
206  };
207 
208  ~XdsClusterManagerLb() override;
209 
210  void ShutdownLocked() override;
211 
212  void UpdateStateLocked();
213 
214  // Current config from the resolver.
215  RefCountedPtr<XdsClusterManagerLbConfig> config_;
216 
217  // Internal state.
218  bool shutting_down_ = false;
219  bool update_in_progress_ = false;
220 
221  // Children.
222  std::map<std::string, OrphanablePtr<ClusterChild>> children_;
223 };
224 
225 //
226 // XdsClusterManagerLb::ClusterPicker
227 //
228 
229 XdsClusterManagerLb::PickResult XdsClusterManagerLb::ClusterPicker::Pick(
230  PickArgs args) {
231  auto* call_state = static_cast<ClientChannel::LoadBalancedCall::LbCallState*>(
232  args.call_state);
233  auto cluster_name =
234  call_state->GetCallAttribute(XdsClusterAttributeTypeName());
235  auto it = cluster_map_.find(cluster_name);
236  if (it != cluster_map_.end()) {
237  return it->second->Pick(args);
238  }
240  "xds cluster manager picker: unknown cluster \"", cluster_name, "\"")));
241 }
242 
243 //
244 // XdsClusterManagerLb
245 //
246 
247 XdsClusterManagerLb::XdsClusterManagerLb(Args args)
248  : LoadBalancingPolicy(std::move(args)) {}
249 
250 XdsClusterManagerLb::~XdsClusterManagerLb() {
252  gpr_log(
253  GPR_INFO,
254  "[xds_cluster_manager_lb %p] destroying xds_cluster_manager LB policy",
255  this);
256  }
257 }
258 
259 void XdsClusterManagerLb::ShutdownLocked() {
261  gpr_log(GPR_INFO, "[xds_cluster_manager_lb %p] shutting down", this);
262  }
263  shutting_down_ = true;
264  children_.clear();
265 }
266 
268  for (auto& p : children_) p.second->ExitIdleLocked();
269 }
270 
271 void XdsClusterManagerLb::ResetBackoffLocked() {
272  for (auto& p : children_) p.second->ResetBackoffLocked();
273 }
274 
275 void XdsClusterManagerLb::UpdateLocked(UpdateArgs args) {
276  if (shutting_down_) return;
278  gpr_log(GPR_INFO, "[xds_cluster_manager_lb %p] Received update", this);
279  }
280  update_in_progress_ = true;
281  // Update config.
282  config_ = std::move(args.config);
283  // Deactivate the children not in the new config.
284  for (const auto& p : children_) {
285  const std::string& name = p.first;
286  ClusterChild* child = p.second.get();
287  if (config_->cluster_map().find(name) == config_->cluster_map().end()) {
288  child->DeactivateLocked();
289  }
290  }
291  // Add or update the children in the new config.
292  for (const auto& p : config_->cluster_map()) {
293  const std::string& name = p.first;
294  const RefCountedPtr<LoadBalancingPolicy::Config>& config = p.second;
295  auto& child = children_[name];
296  if (child == nullptr) {
297  child = MakeOrphanable<ClusterChild>(Ref(DEBUG_LOCATION, "ClusterChild"),
298  name);
299  }
300  child->UpdateLocked(config, args.addresses, args.args);
301  }
302  update_in_progress_ = false;
303  UpdateStateLocked();
304 }
305 
306 void XdsClusterManagerLb::UpdateStateLocked() {
307  // If we're in the process of propagating an update from our parent to
308  // our children, ignore any updates that come from the children. We
309  // will instead return a new picker once the update has been seen by
310  // all children. This avoids unnecessary picker churn while an update
311  // is being propagated to our children.
312  if (update_in_progress_) return;
313  // Also count the number of children in each state, to determine the
314  // overall state.
315  size_t num_ready = 0;
316  size_t num_connecting = 0;
317  size_t num_idle = 0;
318  size_t num_transient_failures = 0;
319  for (const auto& p : children_) {
320  const auto& child_name = p.first;
321  const ClusterChild* child = p.second.get();
322  // Skip the children that are not in the latest update.
323  if (config_->cluster_map().find(child_name) ==
324  config_->cluster_map().end()) {
325  continue;
326  }
327  switch (child->connectivity_state()) {
328  case GRPC_CHANNEL_READY: {
329  ++num_ready;
330  break;
331  }
333  ++num_connecting;
334  break;
335  }
336  case GRPC_CHANNEL_IDLE: {
337  ++num_idle;
338  break;
339  }
341  ++num_transient_failures;
342  break;
343  }
344  default:
345  GPR_UNREACHABLE_CODE(return );
346  }
347  }
348  // Determine aggregated connectivity state.
349  grpc_connectivity_state connectivity_state;
350  if (num_ready > 0) {
351  connectivity_state = GRPC_CHANNEL_READY;
352  } else if (num_connecting > 0) {
353  connectivity_state = GRPC_CHANNEL_CONNECTING;
354  } else if (num_idle > 0) {
355  connectivity_state = GRPC_CHANNEL_IDLE;
356  } else {
357  connectivity_state = GRPC_CHANNEL_TRANSIENT_FAILURE;
358  }
360  gpr_log(GPR_INFO, "[xds_cluster_manager_lb %p] connectivity changed to %s",
361  this, ConnectivityStateName(connectivity_state));
362  }
363  ClusterPicker::ClusterMap cluster_map;
364  for (const auto& p : config_->cluster_map()) {
365  const std::string& cluster_name = p.first;
366  RefCountedPtr<ChildPickerWrapper>& child_picker = cluster_map[cluster_name];
367  child_picker = children_[cluster_name]->picker_wrapper();
368  if (child_picker == nullptr) {
371  "[xds_cluster_manager_lb %p] child %s has not yet returned a "
372  "picker; creating a QueuePicker.",
373  this, cluster_name.c_str());
374  }
375  child_picker = MakeRefCounted<ChildPickerWrapper>(
376  cluster_name,
377  absl::make_unique<QueuePicker>(Ref(DEBUG_LOCATION, "QueuePicker")));
378  }
379  }
380  std::unique_ptr<SubchannelPicker> picker =
381  absl::make_unique<ClusterPicker>(std::move(cluster_map));
383  if (connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
385  "TRANSIENT_FAILURE from XdsClusterManagerLb");
386  }
387  channel_control_helper()->UpdateState(connectivity_state, status,
388  std::move(picker));
389 }
390 
391 //
392 // XdsClusterManagerLb::ClusterChild
393 //
394 
395 XdsClusterManagerLb::ClusterChild::ClusterChild(
396  RefCountedPtr<XdsClusterManagerLb> xds_cluster_manager_policy,
397  const std::string& name)
398  : xds_cluster_manager_policy_(std::move(xds_cluster_manager_policy)),
399  name_(name) {
402  "[xds_cluster_manager_lb %p] created ClusterChild %p for %s",
403  xds_cluster_manager_policy_.get(), this, name_.c_str());
404  }
405  GRPC_CLOSURE_INIT(&on_delayed_removal_timer_, OnDelayedRemovalTimer, this,
406  grpc_schedule_on_exec_ctx);
407 }
408 
409 XdsClusterManagerLb::ClusterChild::~ClusterChild() {
412  "[xds_cluster_manager_lb %p] ClusterChild %p: destroying "
413  "child",
414  xds_cluster_manager_policy_.get(), this);
415  }
416  xds_cluster_manager_policy_.reset(DEBUG_LOCATION, "ClusterChild");
417 }
418 
419 void XdsClusterManagerLb::ClusterChild::Orphan() {
422  "[xds_cluster_manager_lb %p] ClusterChild %p %s: "
423  "shutting down child",
424  xds_cluster_manager_policy_.get(), this, name_.c_str());
425  }
426  // Remove the child policy's interested_parties pollset_set from the
427  // xDS policy.
429  child_policy_->interested_parties(),
430  xds_cluster_manager_policy_->interested_parties());
431  child_policy_.reset();
432  // Drop our ref to the child's picker, in case it's holding a ref to
433  // the child.
434  picker_wrapper_.reset();
437  }
438  shutdown_ = true;
439  Unref();
440 }
441 
442 OrphanablePtr<LoadBalancingPolicy>
443 XdsClusterManagerLb::ClusterChild::CreateChildPolicyLocked(
444  const grpc_channel_args* args) {
445  LoadBalancingPolicy::Args lb_policy_args;
446  lb_policy_args.work_serializer =
447  xds_cluster_manager_policy_->work_serializer();
448  lb_policy_args.args = args;
449  lb_policy_args.channel_control_helper =
450  absl::make_unique<Helper>(this->Ref(DEBUG_LOCATION, "Helper"));
451  OrphanablePtr<LoadBalancingPolicy> lb_policy =
452  MakeOrphanable<ChildPolicyHandler>(std::move(lb_policy_args),
456  "[xds_cluster_manager_lb %p] ClusterChild %p %s: Created "
457  "new child "
458  "policy handler %p",
459  xds_cluster_manager_policy_.get(), this, name_.c_str(),
460  lb_policy.get());
461  }
462  // Add the xDS's interested_parties pollset_set to that of the newly created
463  // child policy. This will make the child policy progress upon activity on
464  // xDS LB, which in turn is tied to the application's call.
466  lb_policy->interested_parties(),
467  xds_cluster_manager_policy_->interested_parties());
468  return lb_policy;
469 }
470 
471 void XdsClusterManagerLb::ClusterChild::UpdateLocked(
472  RefCountedPtr<LoadBalancingPolicy::Config> config,
473  const absl::StatusOr<ServerAddressList>& addresses,
474  const grpc_channel_args* args) {
475  if (xds_cluster_manager_policy_->shutting_down_) return;
476  // Update child weight.
477  // Reactivate if needed.
481  }
482  // Create child policy if needed.
483  if (child_policy_ == nullptr) {
484  child_policy_ = CreateChildPolicyLocked(args);
485  }
486  // Construct update args.
487  UpdateArgs update_args;
488  update_args.config = std::move(config);
489  update_args.addresses = addresses;
490  update_args.args = grpc_channel_args_copy(args);
491  // Update the policy.
494  "[xds_cluster_manager_lb %p] ClusterChild %p %s: "
495  "Updating child "
496  "policy handler %p",
497  xds_cluster_manager_policy_.get(), this, name_.c_str(),
498  child_policy_.get());
499  }
500  child_policy_->UpdateLocked(std::move(update_args));
501 }
502 
504  child_policy_->ExitIdleLocked();
505 }
506 
507 void XdsClusterManagerLb::ClusterChild::ResetBackoffLocked() {
508  child_policy_->ResetBackoffLocked();
509 }
510 
511 void XdsClusterManagerLb::ClusterChild::DeactivateLocked() {
512  // If already deactivated, don't do that again.
514  // Set the child weight to 0 so that future picker won't contain this child.
515  // Start a timer to delete the child.
516  Ref(DEBUG_LOCATION, "ClusterChild+timer").release();
518  ExecCtx::Get()->Now() +
523 }
524 
525 void XdsClusterManagerLb::ClusterChild::OnDelayedRemovalTimer(
526  void* arg, grpc_error_handle error) {
527  ClusterChild* self = static_cast<ClusterChild*>(arg);
528  (void)GRPC_ERROR_REF(error); // Ref owned by the lambda
529  self->xds_cluster_manager_policy_->work_serializer()->Run(
530  [self, error]() { self->OnDelayedRemovalTimerLocked(error); },
532 }
533 
534 void XdsClusterManagerLb::ClusterChild::OnDelayedRemovalTimerLocked(
538  xds_cluster_manager_policy_->children_.erase(name_);
539  }
540  Unref(DEBUG_LOCATION, "ClusterChild+timer");
542 }
543 
544 //
545 // XdsClusterManagerLb::ClusterChild::Helper
546 //
547 
548 RefCountedPtr<SubchannelInterface>
549 XdsClusterManagerLb::ClusterChild::Helper::CreateSubchannel(
550  ServerAddress address, const grpc_channel_args& args) {
551  if (xds_cluster_manager_child_->xds_cluster_manager_policy_->shutting_down_) {
552  return nullptr;
553  }
554  return xds_cluster_manager_child_->xds_cluster_manager_policy_
555  ->channel_control_helper()
556  ->CreateSubchannel(std::move(address), args);
557 }
558 
559 void XdsClusterManagerLb::ClusterChild::Helper::UpdateState(
561  std::unique_ptr<SubchannelPicker> picker) {
563  gpr_log(
564  GPR_INFO,
565  "[xds_cluster_manager_lb %p] child %s: received update: state=%s (%s) "
566  "picker=%p",
567  xds_cluster_manager_child_->xds_cluster_manager_policy_.get(),
569  status.ToString().c_str(), picker.get());
570  }
571  if (xds_cluster_manager_child_->xds_cluster_manager_policy_->shutting_down_) {
572  return;
573  }
574  // Cache the picker in the ClusterChild.
575  xds_cluster_manager_child_->picker_wrapper_ =
576  MakeRefCounted<ChildPickerWrapper>(xds_cluster_manager_child_->name_,
577  std::move(picker));
578  // Decide what state to report for aggregation purposes.
579  // If the last recorded state was TRANSIENT_FAILURE and the new state
580  // is something other than READY, don't change the state.
581  if (xds_cluster_manager_child_->connectivity_state_ !=
584  xds_cluster_manager_child_->connectivity_state_ = state;
585  }
586  // Notify the LB policy.
587  xds_cluster_manager_child_->xds_cluster_manager_policy_->UpdateStateLocked();
588 }
589 
590 void XdsClusterManagerLb::ClusterChild::Helper::RequestReresolution() {
591  if (xds_cluster_manager_child_->xds_cluster_manager_policy_->shutting_down_) {
592  return;
593  }
594  xds_cluster_manager_child_->xds_cluster_manager_policy_
595  ->channel_control_helper()
596  ->RequestReresolution();
597 }
598 
599 absl::string_view XdsClusterManagerLb::ClusterChild::Helper::GetAuthority() {
600  return xds_cluster_manager_child_->xds_cluster_manager_policy_
601  ->channel_control_helper()
602  ->GetAuthority();
603 }
604 
605 void XdsClusterManagerLb::ClusterChild::Helper::AddTraceEvent(
606  TraceSeverity severity, absl::string_view message) {
607  if (xds_cluster_manager_child_->xds_cluster_manager_policy_->shutting_down_) {
608  return;
609  }
610  xds_cluster_manager_child_->xds_cluster_manager_policy_
611  ->channel_control_helper()
612  ->AddTraceEvent(severity, message);
613 }
614 
615 //
616 // factory
617 //
618 
619 class XdsClusterManagerLbFactory : public LoadBalancingPolicyFactory {
620  public:
621  OrphanablePtr<LoadBalancingPolicy> CreateLoadBalancingPolicy(
622  LoadBalancingPolicy::Args args) const override {
623  return MakeOrphanable<XdsClusterManagerLb>(std::move(args));
624  }
625 
626  const char* name() const override { return kXdsClusterManager; }
627 
628  RefCountedPtr<LoadBalancingPolicy::Config> ParseLoadBalancingConfig(
629  const Json& json, grpc_error_handle* error) const override {
631  if (json.type() == Json::Type::JSON_NULL) {
632  // xds_cluster_manager was mentioned as a policy in the deprecated
633  // loadBalancingPolicy field or in the client API.
635  "field:loadBalancingPolicy error:xds_cluster_manager policy requires "
636  "configuration. Please use loadBalancingConfig field of service "
637  "config instead.");
638  return nullptr;
639  }
640  std::vector<grpc_error_handle> error_list;
641  XdsClusterManagerLbConfig::ClusterMap cluster_map;
642  std::set<std::string /*cluster_name*/> clusters_to_be_used;
643  auto it = json.object_value().find("children");
644  if (it == json.object_value().end()) {
645  error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
646  "field:children error:required field not present"));
647  } else if (it->second.type() != Json::Type::OBJECT) {
648  error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
649  "field:children error:type should be object"));
650  } else {
651  for (const auto& p : it->second.object_value()) {
652  const std::string& child_name = p.first;
653  if (child_name.empty()) {
654  error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
655  "field:children element error: name cannot be empty"));
656  continue;
657  }
658  RefCountedPtr<LoadBalancingPolicy::Config> child_config;
659  std::vector<grpc_error_handle> child_errors =
660  ParseChildConfig(p.second, &child_config);
661  if (!child_errors.empty()) {
663  absl::StrCat("field:children name:", child_name), &child_errors));
664  } else {
665  cluster_map[child_name] = std::move(child_config);
666  clusters_to_be_used.insert(child_name);
667  }
668  }
669  }
670  if (cluster_map.empty()) {
671  error_list.push_back(
672  GRPC_ERROR_CREATE_FROM_STATIC_STRING("no valid children configured"));
673  }
674  if (!error_list.empty()) {
676  "xds_cluster_manager_experimental LB policy config", &error_list);
677  return nullptr;
678  }
679  return MakeRefCounted<XdsClusterManagerLbConfig>(std::move(cluster_map));
680  }
681 
682  private:
683  static std::vector<grpc_error_handle> ParseChildConfig(
684  const Json& json,
685  RefCountedPtr<LoadBalancingPolicy::Config>* child_config) {
686  std::vector<grpc_error_handle> error_list;
687  if (json.type() != Json::Type::OBJECT) {
688  error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
689  "value should be of type object"));
690  return error_list;
691  }
692  auto it = json.object_value().find("childPolicy");
693  if (it == json.object_value().end()) {
694  error_list.push_back(
695  GRPC_ERROR_CREATE_FROM_STATIC_STRING("did not find childPolicy"));
696  } else {
698  *child_config = LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(
699  it->second, &parse_error);
700  if (*child_config == nullptr) {
702  std::vector<grpc_error_handle> child_errors;
703  child_errors.push_back(parse_error);
704  error_list.push_back(
705  GRPC_ERROR_CREATE_FROM_VECTOR("field:childPolicy", &child_errors));
706  }
707  }
708  return error_list;
709  }
710 };
711 
712 } // namespace
713 
714 } // namespace grpc_core
715 
716 //
717 // Plugin registration
718 //
719 
723  absl::make_unique<grpc_core::XdsClusterManagerLbFactory>());
724 }
725 
GRPC_CLOSURE_INIT
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler)
Definition: closure.h:115
trace.h
GPR_INFO
#define GPR_INFO
Definition: include/grpc/impl/codegen/log.h:56
GRPC_CHANNEL_READY
@ GRPC_CHANNEL_READY
Definition: include/grpc/impl/codegen/connectivity_state.h:36
regen-readme.it
it
Definition: regen-readme.py:15
grpc_core::LoadBalancingPolicyRegistry::Builder::RegisterLoadBalancingPolicyFactory
static void RegisterLoadBalancingPolicyFactory(std::unique_ptr< LoadBalancingPolicyFactory > factory)
Definition: lb_policy_registry.cc:87
orphanable.h
GRPC_ERROR_NONE
#define GRPC_ERROR_NONE
Definition: error.h:234
log.h
call_state
Definition: test/core/fling/server.cc:74
bloat_diff.severity
def severity
Definition: bloat_diff.py:143
cluster_map_
ClusterMap cluster_map_
Definition: xds_cluster_manager.cc:87
absl::Status::ToString
std::string ToString(StatusToStringMode mode=StatusToStringMode::kDefault) const
Definition: third_party/abseil-cpp/absl/status/status.h:821
absl::StrCat
std::string StrCat(const AlphaNum &a, const AlphaNum &b)
Definition: abseil-cpp/absl/strings/str_cat.cc:98
connectivity_state.h
GPR_DEBUG_ASSERT
#define GPR_DEBUG_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:103
grpc_core::XdsClusterAttributeTypeName
UniqueTypeName XdsClusterAttributeTypeName()
Definition: xds_resolver.cc:98
grpc_core
Definition: call_metric_recorder.h:31
cluster_name
std::string cluster_name
Definition: xds_cluster_resolver.cc:91
GRPC_XDS_CLUSTER_MANAGER_CHILD_RETENTION_INTERVAL_MS
#define GRPC_XDS_CLUSTER_MANAGER_CHILD_RETENTION_INTERVAL_MS
Definition: xds_cluster_manager.cc:63
ExitIdleLocked
void StartUpdate() ABSL_EXCLUSIVE_LOCKS_REQUIRED(&RlsLb void MaybeFinishUpdate() ABSL_LOCKS_EXCLUDED(&RlsLb void ExitIdleLocked()
Definition: rls.cc:299
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
error
grpc_error_handle error
Definition: retry_filter.cc:499
lb_policy.h
client_channel.h
update_in_progress_
bool update_in_progress_
Definition: xds_cluster_manager.cc:219
lb_policy_factory.h
GRPC_CHANNEL_TRANSIENT_FAILURE
@ GRPC_CHANNEL_TRANSIENT_FAILURE
Definition: include/grpc/impl/codegen/connectivity_state.h:38
xds_cluster_manager_child_
RefCountedPtr< ClusterChild > xds_cluster_manager_child_
Definition: xds_cluster_manager.cc:180
children_
std::map< std::string, OrphanablePtr< ClusterChild > > children_
Definition: xds_cluster_manager.cc:222
connectivity_state_
grpc_connectivity_state connectivity_state_
Definition: xds_cluster_manager.cc:199
config_
RefCountedPtr< XdsClusterManagerLbConfig > config_
Definition: xds_cluster_manager.cc:215
closure.h
status
absl::Status status
Definition: rls.cc:251
setup.name
name
Definition: setup.py:542
grpc_lb_policy_xds_cluster_manager_shutdown
void grpc_lb_policy_xds_cluster_manager_shutdown()
Definition: xds_cluster_manager.cc:726
absl::InternalError
Status InternalError(absl::string_view message)
Definition: third_party/abseil-cpp/absl/status/status.cc:347
xds_manager.p
p
Definition: xds_manager.py:60
grpc_timer
Definition: iomgr/timer.h:33
grpc_pollset_set_del_pollset_set
void grpc_pollset_set_del_pollset_set(grpc_pollset_set *bag, grpc_pollset_set *item)
Definition: pollset_set.cc:52
map
zval * map
Definition: php/ext/google/protobuf/encode_decode.c:480
grpc_channel_args
Definition: grpc_types.h:132
GRPC_TRACE_FLAG_ENABLED
#define GRPC_TRACE_FLAG_ENABLED(f)
Definition: debug/trace.h:114
subchannel_interface.h
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
grpc_connectivity_state
grpc_connectivity_state
Definition: include/grpc/impl/codegen/connectivity_state.h:30
GRPC_ERROR_CREATE_FROM_VECTOR
#define GRPC_ERROR_CREATE_FROM_VECTOR(desc, error_list)
Definition: error.h:314
grpc_types.h
absl::synchronization_internal::Get
static GraphId Get(const IdMap &id, int num)
Definition: abseil-cpp/absl/synchronization/internal/graphcycles_test.cc:44
DEBUG_LOCATION
#define DEBUG_LOCATION
Definition: debug_location.h:41
absl::Milliseconds
constexpr Duration Milliseconds(T n)
Definition: third_party/abseil-cpp/absl/time/time.h:415
xds_cluster_manager_policy_
RefCountedPtr< XdsClusterManagerLb > xds_cluster_manager_policy_
Definition: xds_cluster_manager.cc:191
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
hpack_encoder_fixtures::Args
Args({0, 16384})
Json
JSON (JavaScript Object Notation).
Definition: third_party/bloaty/third_party/protobuf/conformance/third_party/jsoncpp/json.h:227
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
work_serializer.h
connectivity_state.h
pollset_set.h
GRPC_CHANNEL_IDLE
@ GRPC_CHANNEL_IDLE
Definition: include/grpc/impl/codegen/connectivity_state.h:32
arg
Definition: cmdline.cc:40
server_address.h
time.h
grpc_channel_args_copy
grpc_channel_args * grpc_channel_args_copy(const grpc_channel_args *src)
Definition: channel_args.cc:285
googletest-filter-unittest.child
child
Definition: bloaty/third_party/googletest/googletest/test/googletest-filter-unittest.py:62
error.h
json.h
GPR_UNREACHABLE_CODE
#define GPR_UNREACHABLE_CODE(STATEMENT)
Definition: impl/codegen/port_platform.h:652
name_
std::string name_
Definition: xds_cluster_manager.cc:113
xds_resolver.h
GRPC_ERROR_CREATE_FROM_STATIC_STRING
#define GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc)
Definition: error.h:291
shutdown_
bool shutdown_
Definition: xds_cluster_manager.cc:205
GRPC_CHANNEL_CONNECTING
@ GRPC_CHANNEL_CONNECTING
Definition: include/grpc/impl/codegen/connectivity_state.h:34
picker_
std::unique_ptr< SubchannelPicker > picker_
Definition: xds_cluster_manager.cc:114
child_policy_handler.h
absl::Status
ABSL_NAMESPACE_BEGIN class ABSL_MUST_USE_RESULT Status
Definition: abseil-cpp/absl/status/internal/status_internal.h:36
grpc_timer_cancel
void grpc_timer_cancel(grpc_timer *timer)
Definition: iomgr/timer.cc:36
absl::Now
ABSL_NAMESPACE_BEGIN Time Now()
Definition: abseil-cpp/absl/time/clock.cc:39
grpc_core::ConnectivityStateName
const char * ConnectivityStateName(grpc_connectivity_state state)
Definition: connectivity_state.cc:38
GRPC_ERROR_REF
#define GRPC_ERROR_REF(err)
Definition: error.h:261
debug_location.h
picker_wrapper_
RefCountedPtr< ChildPickerWrapper > picker_wrapper_
Definition: xds_cluster_manager.cc:198
lb_policy_registry.h
delayed_removal_timer_callback_pending_
bool delayed_removal_timer_callback_pending_
Definition: xds_cluster_manager.cc:204
ref_counted.h
grpc_core::grpc_xds_cluster_manager_lb_trace
TraceFlag grpc_xds_cluster_manager_lb_trace(false, "xds_cluster_manager_lb")
on_delayed_removal_timer_
grpc_closure on_delayed_removal_timer_
Definition: xds_cluster_manager.cc:203
absl::Status
Definition: third_party/abseil-cpp/absl/status/status.h:424
delayed_removal_timer_
grpc_timer delayed_removal_timer_
Definition: xds_cluster_manager.cc:202
child_policy_
OrphanablePtr< LoadBalancingPolicy > child_policy_
Definition: xds_cluster_manager.cc:196
std
Definition: grpcpp/impl/codegen/async_unary_call.h:407
grpc_pollset_set_add_pollset_set
void grpc_pollset_set_add_pollset_set(grpc_pollset_set *bag, grpc_pollset_set *item)
Definition: pollset_set.cc:47
cpp.gmock_class.set
set
Definition: bloaty/third_party/googletest/googlemock/scripts/generator/cpp/gmock_class.py:44
arg
struct arg arg
state
Definition: bloaty/third_party/zlib/contrib/blast/blast.c:41
exec_ctx.h
GRPC_ERROR_CREATE_FROM_VECTOR_AND_CPP_STRING
#define GRPC_ERROR_CREATE_FROM_VECTOR_AND_CPP_STRING(desc, error_list)
Definition: error.h:317
grpc_timer_init
void grpc_timer_init(grpc_timer *timer, grpc_core::Timestamp deadline, grpc_closure *closure)
Definition: iomgr/timer.cc:31
GRPC_ERROR_UNREF
#define GRPC_ERROR_UNREF(err)
Definition: error.h:262
ref_counted_ptr.h
config_s
Definition: bloaty/third_party/zlib/deflate.c:120
channel_args.h
timer.h
check_redundant_namespace_qualifiers.Config
Config
Definition: check_redundant_namespace_qualifiers.py:142
Fail
void Fail(const char *msg)
Definition: bloaty/third_party/googletest/googletest/test/gtest_assert_by_exception_test.cc:52
absl::StatusOr< ServerAddressList >
absl::StatusCode::kUnavailable
@ kUnavailable
grpc_error
Definition: error_internal.h:42
shutting_down_
bool shutting_down_
Definition: xds_cluster_manager.cc:218
testing::Ref
internal::RefMatcher< T & > Ref(T &x)
Definition: cares/cares/test/gmock-1.8.0/gmock/gmock.h:8628
grpc_closure
Definition: closure.h:56
state
static struct rpc_state state
Definition: bad_server_response_test.cc:87
grpc_lb_policy_xds_cluster_manager_init
void grpc_lb_policy_xds_cluster_manager_init()
Definition: xds_cluster_manager.cc:720
GRPC_ERROR_IS_NONE
#define GRPC_ERROR_IS_NONE(err)
Definition: error.h:241
parse_error
@ parse_error
Definition: pem_info.c:88
port_platform.h


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:57