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

          Line data    Source code
       1             : #include "source/extensions/load_balancing_policies/maglev/config.h"
       2             : 
       3             : #include "envoy/extensions/load_balancing_policies/maglev/v3/maglev.pb.h"
       4             : 
       5             : #include "source/extensions/load_balancing_policies/maglev/maglev_lb.h"
       6             : 
       7             : namespace Envoy {
       8             : namespace Extensions {
       9             : namespace LoadBalancingPolices {
      10             : namespace Maglev {
      11             : 
      12             : Upstream::ThreadAwareLoadBalancerPtr
      13             : Factory::create(OptRef<const Upstream::LoadBalancerConfig> lb_config,
      14             :                 const Upstream::ClusterInfo& cluster_info,
      15             :                 const Upstream::PrioritySet& priority_set, Runtime::Loader& runtime,
      16           0 :                 Random::RandomGenerator& random, TimeSource&) {
      17             : 
      18           0 :   auto active_or_legacy =
      19           0 :       Common::ActiveOrLegacy<Upstream::TypedMaglevLbConfig, Upstream::LegacyMaglevLbConfig>::get(
      20           0 :           lb_config.ptr());
      21             : 
      22             :   // Assume legacy config.
      23           0 :   if (!active_or_legacy.hasActive()) {
      24           0 :     return std::make_unique<Upstream::MaglevLoadBalancer>(
      25           0 :         priority_set, cluster_info.lbStats(), cluster_info.statsScope(), runtime, random,
      26           0 :         !active_or_legacy.hasLegacy() ? cluster_info.lbMaglevConfig()
      27           0 :                                       : active_or_legacy.legacy()->lbConfig(),
      28           0 :         cluster_info.lbConfig());
      29           0 :   }
      30             : 
      31           0 :   return std::make_unique<Upstream::MaglevLoadBalancer>(
      32           0 :       priority_set, cluster_info.lbStats(), cluster_info.statsScope(), runtime, random,
      33           0 :       static_cast<uint32_t>(PROTOBUF_PERCENT_TO_ROUNDED_INTEGER_OR_DEFAULT(
      34           0 :           cluster_info.lbConfig(), healthy_panic_threshold, 100, 50)),
      35           0 :       active_or_legacy.active()->lb_config_);
      36           0 : }
      37             : 
      38             : /**
      39             :  * Static registration for the Factory. @see RegisterFactory.
      40             :  */
      41             : REGISTER_FACTORY(Factory, Upstream::TypedLoadBalancerFactory);
      42             : 
      43             : } // namespace Maglev
      44             : } // namespace LoadBalancingPolices
      45             : } // namespace Extensions
      46             : } // namespace Envoy

Generated by: LCOV version 1.15