#pragma once #include #include #include #include namespace DB { class Context; /// Manages user-defined models. class ExternalModelsLoader : public ExternalLoader { public: using ModelPtr = std::shared_ptr; /// Models will be loaded immediately and then will be updated in separate thread, each 'reload_period' seconds. ExternalModelsLoader( std::unique_ptr config_repository, Context & context_); ModelPtr getModel(const std::string & name) const { return std::static_pointer_cast(getLoadable(name)); } protected: LoadablePtr create(const std::string & name, const Poco::Util::AbstractConfiguration & config, const std::string & key_in_config) const override; friend class StorageSystemModels; private: Context & context; }; }