LCOV - code coverage report
Current view: top level - envoy/rds - config_traits.h (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 2 2 100.0 %
Date: 2024-01-05 06:35:25 Functions: 2 2 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <memory>
       4             : 
       5             : #include "envoy/common/pure.h"
       6             : #include "envoy/rds/config.h"
       7             : #include "envoy/server/factory_context.h"
       8             : 
       9             : #include "source/common/protobuf/protobuf.h"
      10             : 
      11             : namespace Envoy {
      12             : namespace Rds {
      13             : 
      14             : /**
      15             :  * Traits of the protocol specific route configuration and proto.
      16             :  * The generic rds classes will call the methods of this interface
      17             :  * to get information which is not visible for them directly.
      18             :  */
      19             : class ProtoTraits {
      20             : public:
      21          96 :   virtual ~ProtoTraits() = default;
      22             : 
      23             :   /**
      24             :    * Give the full name of the route configuration proto description.
      25             :    * For example 'envoy.config.route.v3.RouteConfiguration'
      26             :    */
      27             :   virtual const std::string& resourceType() const PURE;
      28             : 
      29             :   /**
      30             :    * Gives back the name field tag number of the route configuration proto.
      31             :    */
      32             :   virtual int resourceNameFieldNumber() const PURE;
      33             : 
      34             :   /**
      35             :    * Create an empty route configuration proto object.
      36             :    */
      37             :   virtual ProtobufTypes::MessagePtr createEmptyProto() const PURE;
      38             : };
      39             : 
      40             : class ConfigTraits {
      41             : public:
      42         124 :   virtual ~ConfigTraits() = default;
      43             : 
      44             :   /**
      45             :    * Create a dummy config object without actual route configuration.
      46             :    * This object will be used before the first valid route configuration is fetched.
      47             :    */
      48             :   virtual ConfigConstSharedPtr createNullConfig() const PURE;
      49             : 
      50             :   /**
      51             :    * Create a config object based on a route configuration.
      52             :    * The full name of the type of the parameter message is
      53             :    * guaranteed to match with the return value of ProtoTraits::resourceType.
      54             :    * Both dynamic or static cast can be applied to downcast the message
      55             :    * to the corresponding route configuration class.
      56             :    * @param rc supplies the RouteConfiguration.
      57             :    * @param context supplies the context of the server factory.
      58             :    * @param validate_clusters_default specifies whether the clusters that the route
      59             :    *    table refers to will be validated by the cluster manager. Currently thrift
      60             :    *    route config provider manager validates the clusters for static route config
      61             :    *    by default but doesn't validate the clusters for TRDS.
      62             :    * @throw EnvoyException if the new config can't be applied of.
      63             :    */
      64             :   virtual ConfigConstSharedPtr createConfig(const Protobuf::Message& rc,
      65             :                                             Server::Configuration::ServerFactoryContext& context,
      66             :                                             bool validate_clusters_default) const PURE;
      67             : };
      68             : 
      69             : } // namespace Rds
      70             : } // namespace Envoy

Generated by: LCOV version 1.15