ClickHouse/dbms/src/Interpreters/ExternalModels.h
proller dd2371e071 CLICKHOUSE-4137 DictionaryFactory, DictionarySourceFactory (#3653)
* Split ComplexKeyCacheDictionary to faster compile (part2)

* Dictionaries as lib WIP

* wip

* clean

* Fix build with old capnp

* fix

* wip

* fixes

* fix

* clean

* clean

* clean

* wip

* wip

* wip

* flat

* wip

* cache

* clean

* wip

* faster

* fix style

* fixes

* clean

* clean

* Split CacheDictionary.cpp for faster compile

* fix

* fix

* Less memory usage while compiling

* missing file

* format

* Update registerDictionaries.h

* clean
2018-11-28 14:37:12 +03:00

48 lines
1.1 KiB
C++

#pragma once
#include <Interpreters/CatBoostModel.h>
#include <Interpreters/ExternalLoader.h>
#include <common/logger_useful.h>
#include <memory>
namespace DB
{
class Context;
/// Manages user-defined models.
class ExternalModels : public ExternalLoader
{
public:
using ModelPtr = std::shared_ptr<IModel>;
/// Models will be loaded immediately and then will be updated in separate thread, each 'reload_period' seconds.
ExternalModels(
std::unique_ptr<IExternalLoaderConfigRepository> config_repository,
Context & context,
bool throw_on_error);
/// Forcibly reloads specified model.
void reloadModel(const std::string & name) { reload(name); }
ModelPtr getModel(const std::string & name) const
{
return std::static_pointer_cast<IModel>(getLoadable(name));
}
protected:
std::unique_ptr<IExternalLoadable> create(const std::string & name, const Configuration & config,
const std::string & config_prefix) override;
using ExternalLoader::getObjectsMap;
friend class StorageSystemModels;
private:
Context & context;
};
}