2017-04-01 09:19:00 +00:00
|
|
|
#include <Interpreters/ExternalDictionaries.h>
|
2017-08-24 14:51:13 +00:00
|
|
|
#include <Interpreters/Context.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Dictionaries/DictionaryFactory.h>
|
2015-06-09 16:12:51 +00:00
|
|
|
|
2015-01-21 11:39:48 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2019-03-15 00:29:53 +00:00
|
|
|
/// Must not acquire Context lock in constructor to avoid possibility of deadlocks.
|
2017-11-28 11:00:07 +00:00
|
|
|
ExternalDictionaries::ExternalDictionaries(
|
|
|
|
std::unique_ptr<IExternalLoaderConfigRepository> config_repository,
|
2019-03-15 00:29:53 +00:00
|
|
|
const Poco::Util::AbstractConfiguration & config,
|
2019-08-03 11:02:40 +00:00
|
|
|
Context & context_)
|
2019-03-15 00:29:53 +00:00
|
|
|
: ExternalLoader(config,
|
2019-06-02 12:11:01 +00:00
|
|
|
"external dictionary",
|
|
|
|
&Logger::get("ExternalDictionaries")),
|
2019-08-03 11:02:40 +00:00
|
|
|
context(context_)
|
2017-08-24 18:19:06 +00:00
|
|
|
{
|
2019-06-02 12:11:01 +00:00
|
|
|
addConfigRepository(std::move(config_repository), {"dictionary", "name", "dictionaries_config"});
|
|
|
|
enableAsyncLoading(true);
|
|
|
|
enablePeriodicUpdates(true);
|
2017-08-24 18:19:06 +00:00
|
|
|
}
|
|
|
|
|
2019-04-10 18:36:52 +00:00
|
|
|
|
2019-06-02 12:11:01 +00:00
|
|
|
ExternalLoader::LoadablePtr ExternalDictionaries::create(
|
|
|
|
const std::string & name, const Poco::Util::AbstractConfiguration & config, const std::string & key_in_config) const
|
2015-05-26 11:53:58 +00:00
|
|
|
{
|
2019-06-02 12:11:01 +00:00
|
|
|
return DictionaryFactory::instance().create(name, config, key_in_config, context);
|
2015-05-26 11:53:58 +00:00
|
|
|
}
|
|
|
|
|
2015-01-21 11:39:48 +00:00
|
|
|
}
|