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

          Line data    Source code
       1             : #include "source/extensions/matching/input_matchers/consistent_hashing/config.h"
       2             : 
       3             : namespace Envoy {
       4             : namespace Extensions {
       5             : namespace Matching {
       6             : namespace InputMatchers {
       7             : namespace ConsistentHashing {
       8             : 
       9             : Envoy::Matcher::InputMatcherFactoryCb ConsistentHashingConfig::createInputMatcherFactoryCb(
      10           0 :     const Protobuf::Message& config, Server::Configuration::ServerFactoryContext& factory_context) {
      11           0 :   const auto& consistent_hashing_config =
      12           0 :       MessageUtil::downcastAndValidate<const envoy::extensions::matching::input_matchers::
      13           0 :                                            consistent_hashing::v3::ConsistentHashing&>(
      14           0 :           config, factory_context.messageValidationVisitor());
      15             : 
      16           0 :   if (consistent_hashing_config.threshold() > consistent_hashing_config.modulo()) {
      17           0 :     throw EnvoyException(fmt::format("threshold cannot be greater than modulo: {} > {}",
      18           0 :                                      consistent_hashing_config.threshold(),
      19           0 :                                      consistent_hashing_config.modulo()));
      20           0 :   }
      21             : 
      22           0 :   return [consistent_hashing_config]() {
      23           0 :     return std::make_unique<Matcher>(consistent_hashing_config.threshold(),
      24           0 :                                      consistent_hashing_config.modulo(),
      25           0 :                                      consistent_hashing_config.seed());
      26           0 :   };
      27           0 : }
      28             : /**
      29             :  * Static registration for the consistent hashing matcher. @see RegisterFactory.
      30             :  */
      31             : REGISTER_FACTORY(ConsistentHashingConfig, Envoy::Matcher::InputMatcherFactory);
      32             : 
      33             : } // namespace ConsistentHashing
      34             : } // namespace InputMatchers
      35             : } // namespace Matching
      36             : } // namespace Extensions
      37             : } // namespace Envoy

Generated by: LCOV version 1.15