Line data Source code
1 : #pragma once 2 : 3 : #include <memory> 4 : 5 : #include "envoy/server/factory_context.h" 6 : 7 : #include "source/common/protobuf/protobuf.h" 8 : 9 : namespace Envoy { 10 : namespace Server { 11 : 12 : /** 13 : * Parent class for bootstrap extensions. 14 : */ 15 : class BootstrapExtension { 16 : public: 17 0 : virtual ~BootstrapExtension() = default; 18 : 19 : /** 20 : * Called when server is done initializing and we have the ServerFactoryContext fully initialized. 21 : */ 22 : virtual void onServerInitialized() PURE; 23 : }; 24 : 25 : using BootstrapExtensionPtr = std::unique_ptr<BootstrapExtension>; 26 : 27 : namespace Configuration { 28 : 29 : /** 30 : * Implemented for each bootstrap extension and registered via Registry::registerFactory or the 31 : * convenience class RegisterFactory. 32 : */ 33 : class BootstrapExtensionFactory : public Config::TypedFactory { 34 : public: 35 0 : ~BootstrapExtensionFactory() override = default; 36 : 37 : /** 38 : * Create a particular bootstrap extension implementation from a config proto. If the 39 : * implementation is unable to produce a factory with the provided parameters, it should throw an 40 : * EnvoyException. The returned pointer should never be nullptr. 41 : * @param config the custom configuration for this bootstrap extension type. 42 : * @param context is the context to use for the extension. Note that the clusterManager is not 43 : * yet initialized at this point and **must not** be used. 44 : */ 45 : virtual BootstrapExtensionPtr createBootstrapExtension(const Protobuf::Message& config, 46 : ServerFactoryContext& context) PURE; 47 : 48 142 : std::string category() const override { return "envoy.bootstrap"; } 49 : }; 50 : 51 : } // namespace Configuration 52 : } // namespace Server 53 : } // namespace Envoy