Line data Source code
1 : #pragma once 2 : 3 : #include <memory> 4 : #include <string> 5 : 6 : #include "envoy/config/route/v3/route.pb.h" 7 : #include "envoy/event/dispatcher.h" 8 : #include "envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.pb.h" 9 : #include "envoy/json/json_object.h" 10 : #include "envoy/local_info/local_info.h" 11 : #include "envoy/router/rds.h" 12 : #include "envoy/runtime/runtime.h" 13 : #include "envoy/server/filter_config.h" 14 : #include "envoy/thread_local/thread_local.h" 15 : #include "envoy/upstream/cluster_manager.h" 16 : 17 : namespace Envoy { 18 : namespace Router { 19 : 20 : /** 21 : * The RouteConfigProviderManager exposes the ability to get a RouteConfigProvider. This interface 22 : * is exposed to the Server's FactoryContext in order to allow HttpConnectionManagers to get 23 : * RouteConfigProviders. 24 : */ 25 : class RouteConfigProviderManager { 26 : public: 27 96 : virtual ~RouteConfigProviderManager() = default; 28 : 29 : /** 30 : * Get a RouteConfigProviderPtr for a route from RDS. Ownership of the RouteConfigProvider is the 31 : * HttpConnectionManagers who calls this function. The RouteConfigProviderManager holds raw 32 : * pointers to the RouteConfigProviders. Clean up of the pointers happen from the destructor of 33 : * the RouteConfigProvider. This method creates a RouteConfigProvider which may share the 34 : * underlying RDS subscription with the same (route_config_name, cluster). 35 : * @param rds supplies the proto configuration of an RDS-configured RouteConfigProvider. 36 : * @param factory_context is the context to use for the route config provider. 37 : * @param stat_prefix supplies the stat_prefix to use for the provider stats. 38 : * @param init_manager the Init::Manager used to coordinate initialization of a the underlying RDS 39 : * subscription. 40 : */ 41 : virtual RouteConfigProviderSharedPtr createRdsRouteConfigProvider( 42 : const envoy::extensions::filters::network::http_connection_manager::v3::Rds& rds, 43 : Server::Configuration::ServerFactoryContext& factory_context, const std::string& stat_prefix, 44 : Init::Manager& init_manager) PURE; 45 : 46 : /** 47 : * Get a RouteConfigSharedPtr for a statically defined route. Ownership is as described for 48 : * getRdsRouteConfigProvider above. This method always create a new RouteConfigProvider. 49 : * @param route_config supplies the RouteConfiguration for this route 50 : * @param factory_context is the context to use for the route config provider. 51 : * @param validator is the message validator for route config. 52 : */ 53 : virtual RouteConfigProviderPtr 54 : createStaticRouteConfigProvider(const envoy::config::route::v3::RouteConfiguration& route_config, 55 : Server::Configuration::ServerFactoryContext& factory_context, 56 : ProtobufMessage::ValidationVisitor& validator) PURE; 57 : }; 58 : 59 : using RouteConfigProviderManagerPtr = std::unique_ptr<RouteConfigProviderManager>; 60 : using RouteConfigProviderManagerSharedPtr = std::shared_ptr<RouteConfigProviderManager>; 61 : 62 : } // namespace Router 63 : } // namespace Envoy