2019-09-26 11:19:10 +00:00
|
|
|
#include <Interpreters/ExternalDictionariesLoader.h>
|
|
|
|
#include <Interpreters/Context.h>
|
|
|
|
#include <Dictionaries/DictionaryFactory.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
/// Must not acquire Context lock in constructor to avoid possibility of deadlocks.
|
|
|
|
ExternalDictionariesLoader::ExternalDictionariesLoader(
|
2019-09-30 16:12:08 +00:00
|
|
|
ExternalLoaderConfigRepositoryPtr config_repository, Context & context_)
|
|
|
|
: ExternalLoader("external dictionary", &Logger::get("ExternalDictionariesLoader"))
|
|
|
|
, context(context_)
|
2019-09-26 11:19:10 +00:00
|
|
|
{
|
2019-09-30 16:12:08 +00:00
|
|
|
addConfigRepository(std::move(config_repository), {"dictionary", "name"});
|
2019-09-26 11:19:10 +00:00
|
|
|
enableAsyncLoading(true);
|
|
|
|
enablePeriodicUpdates(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ExternalLoader::LoadablePtr ExternalDictionariesLoader::create(
|
|
|
|
const std::string & name, const Poco::Util::AbstractConfiguration & config, const std::string & key_in_config) const
|
|
|
|
{
|
|
|
|
return DictionaryFactory::instance().create(name, config, key_in_config, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|