Lines
100 %
Functions
#include "source/extensions/load_balancing_policies/round_robin/config.h"
#include "envoy/extensions/load_balancing_policies/round_robin/v3/round_robin.pb.h"
namespace Envoy {
namespace Extensions {
namespace LoadBalancingPolicies {
namespace RoundRobin {
Upstream::LoadBalancerPtr RoundRobinCreator::operator()(
Upstream::LoadBalancerParams params, OptRef<const Upstream::LoadBalancerConfig> lb_config,
const Upstream::ClusterInfo& cluster_info, const Upstream::PrioritySet&,
Runtime::Loader& runtime, Random::RandomGenerator& random, TimeSource& time_source) {
const auto typed_lb_config =
dynamic_cast<const Upstream::TypedRoundRobinLbConfig*>(lb_config.ptr());
ASSERT(typed_lb_config != nullptr, "Invalid load balancer config");
return std::make_unique<Upstream::RoundRobinLoadBalancer>(
params.priority_set, params.local_priority_set, cluster_info.lbStats(), runtime, random,
PROTOBUF_PERCENT_TO_ROUNDED_INTEGER_OR_DEFAULT(cluster_info.lbConfig(),
healthy_panic_threshold, 100, 50),
typed_lb_config->lb_config_, time_source);
}
/**
* Static registration for the Factory. @see RegisterFactory.
*/
REGISTER_FACTORY(Factory, Upstream::TypedLoadBalancerFactory);
} // namespace RoundRobin
} // namespace LoadBalancingPolicies
} // namespace Extensions
} // namespace Envoy