mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-14 11:33:46 +00:00
38 lines
826 B
C++
38 lines
826 B
C++
#pragma once
|
|
|
|
#include "CatBoostLibraryHandler.h"
|
|
|
|
#include <base/defines.h>
|
|
#include <Common/ExternalModelInfo.h>
|
|
|
|
#include <chrono>
|
|
#include <mutex>
|
|
#include <unordered_map>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class CatBoostLibraryHandlerFactory final : private boost::noncopyable
|
|
{
|
|
public:
|
|
static CatBoostLibraryHandlerFactory & instance();
|
|
|
|
CatBoostLibraryHandlerFactory();
|
|
|
|
CatBoostLibraryHandlerPtr tryGetModel(const String & model_path, const String & library_path, bool create_if_not_found);
|
|
|
|
void removeModel(const String & model_path);
|
|
void removeAllModels();
|
|
|
|
ExternalModelInfos getModelInfos();
|
|
|
|
private:
|
|
/// map: model path --> catboost library handler
|
|
std::unordered_map<String, CatBoostLibraryHandlerPtr> library_handlers TSA_GUARDED_BY(mutex);
|
|
std::mutex mutex;
|
|
Poco::Logger * log;
|
|
};
|
|
|
|
}
|