#pragma once #include #include #include #include namespace DB { class Context; /// Manages user-defined models. class ExternalModels : 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. ExternalModels( std::unique_ptr config_repository, Context & context); /// Forcibly reloads specified model. void reloadModel(const std::string & name) { reload(name); } ModelPtr getModel(const std::string & name) const { return std::static_pointer_cast(getLoadable(name)); } protected: std::unique_ptr create(const std::string & name, const Configuration & config, const std::string & config_prefix) const override; using ExternalLoader::getObjectsMap; friend class StorageSystemModels; private: Context & context; }; }