mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 19:12:03 +00:00
ea73b98fb9
- Rename generic file and identifier names in library-bridge to something more dictionary-specific. This is needed because later on, catboost will be integrated into library-bridge. - Also: Some smaller fixes like typos and un-inlining non-performance critical code. - The logic remains unchanged in this commit.
40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "ExternalDictionaryLibraryHandler.h"
|
|
#include <base/defines.h>
|
|
|
|
#include <unordered_map>
|
|
#include <mutex>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/// Each library dictionary source has unique UUID. When clone() method is called, a new UUID is generated.
|
|
/// There is a unique mapping from dictionary UUID to sharedLibraryHandler.
|
|
class ExternalDictionaryLibraryHandlerFactory final : private boost::noncopyable
|
|
{
|
|
public:
|
|
static ExternalDictionaryLibraryHandlerFactory & instance();
|
|
|
|
SharedLibraryHandlerPtr get(const std::string & dictionary_id);
|
|
|
|
void create(
|
|
const std::string & dictionary_id,
|
|
const std::string & library_path,
|
|
const std::vector<std::string> & library_settings,
|
|
const Block & sample_block,
|
|
const std::vector<std::string> & attributes_names);
|
|
|
|
bool clone(const std::string & from_dictionary_id, const std::string & to_dictionary_id);
|
|
|
|
bool remove(const std::string & dictionary_id);
|
|
|
|
private:
|
|
/// map: dict_id -> sharedLibraryHandler
|
|
std::unordered_map<std::string, SharedLibraryHandlerPtr> library_handlers TSA_GUARDED_BY(mutex);
|
|
std::mutex mutex;
|
|
};
|
|
|
|
}
|