1 | #pragma once |
---|---|
2 | |
3 | #include <Interpreters/CatBoostModel.h> |
4 | #include <Interpreters/ExternalLoader.h> |
5 | #include <common/logger_useful.h> |
6 | #include <memory> |
7 | |
8 | |
9 | namespace DB |
10 | { |
11 | |
12 | class Context; |
13 | |
14 | /// Manages user-defined models. |
15 | class ExternalModelsLoader : public ExternalLoader |
16 | { |
17 | public: |
18 | using ModelPtr = std::shared_ptr<const IModel>; |
19 | |
20 | /// Models will be loaded immediately and then will be updated in separate thread, each 'reload_period' seconds. |
21 | ExternalModelsLoader(Context & context_); |
22 | |
23 | ModelPtr getModel(const std::string & name) const |
24 | { |
25 | return std::static_pointer_cast<const IModel>(load(name)); |
26 | } |
27 | |
28 | protected: |
29 | LoadablePtr create(const std::string & name, const Poco::Util::AbstractConfiguration & config, |
30 | const std::string & key_in_config, const std::string & repository_name) const override; |
31 | |
32 | friend class StorageSystemModels; |
33 | private: |
34 | |
35 | Context & context; |
36 | }; |
37 | |
38 | } |
39 |