LCOV - code coverage report
Current view: top level - source/extensions/load_balancing_policies/random - config.cc (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 0 15 0.0 %
Date: 2024-01-05 06:35:25 Functions: 0 2 0.0 %

          Line data    Source code
       1             : #include "source/extensions/load_balancing_policies/random/config.h"
       2             : 
       3             : #include "envoy/extensions/load_balancing_policies/random/v3/random.pb.h"
       4             : 
       5             : #include "source/common/upstream/load_balancer_impl.h"
       6             : 
       7             : namespace Envoy {
       8             : namespace Extensions {
       9             : namespace LoadBalancingPolices {
      10             : namespace Random {
      11             : 
      12           0 : TypedRandomLbConfig::TypedRandomLbConfig(const RandomLbProto& lb_config) : lb_config_(lb_config) {}
      13             : 
      14             : Upstream::LoadBalancerPtr RandomCreator::operator()(
      15             :     Upstream::LoadBalancerParams params, OptRef<const Upstream::LoadBalancerConfig> lb_config,
      16             :     const Upstream::ClusterInfo& cluster_info, const Upstream::PrioritySet&,
      17           0 :     Runtime::Loader& runtime, Envoy::Random::RandomGenerator& random, TimeSource&) {
      18             : 
      19           0 :   const auto typed_lb_config = dynamic_cast<const TypedRandomLbConfig*>(lb_config.ptr());
      20             : 
      21           0 :   if (typed_lb_config != nullptr) {
      22           0 :     return std::make_unique<Upstream::RandomLoadBalancer>(
      23           0 :         params.priority_set, params.local_priority_set, cluster_info.lbStats(), runtime, random,
      24           0 :         PROTOBUF_PERCENT_TO_ROUNDED_INTEGER_OR_DEFAULT(cluster_info.lbConfig(),
      25           0 :                                                        healthy_panic_threshold, 100, 50),
      26           0 :         typed_lb_config->lb_config_);
      27           0 :   } else {
      28           0 :     return std::make_unique<Upstream::RandomLoadBalancer>(
      29           0 :         params.priority_set, params.local_priority_set, cluster_info.lbStats(), runtime, random,
      30           0 :         cluster_info.lbConfig());
      31           0 :   }
      32           0 : }
      33             : 
      34             : /**
      35             :  * Static registration for the Factory. @see RegisterFactory.
      36             :  */
      37             : REGISTER_FACTORY(Factory, Upstream::TypedLoadBalancerFactory);
      38             : 
      39             : } // namespace Random
      40             : } // namespace LoadBalancingPolices
      41             : } // namespace Extensions
      42             : } // namespace Envoy

Generated by: LCOV version 1.15