ClickHouse/dbms/src/Interpreters/ExternalDictionaries.h

47 lines
1.1 KiB
C++
Raw Normal View History

#pragma once
#include <Dictionaries/IDictionary.h>
#include <Interpreters/ExternalLoader.h>
2015-09-29 19:19:54 +00:00
#include <common/logger_useful.h>
#include <memory>
namespace DB
{
class Context;
/// Manages user-defined dictionaries.
class ExternalDictionaries : public ExternalLoader
{
public:
using DictPtr = std::shared_ptr<IDictionaryBase>;
/// Dictionaries will be loaded immediately and then will be updated in separate thread, each 'reload_period' seconds.
ExternalDictionaries(Context & context, bool throw_on_error);
/// Forcibly reloads specified dictionary.
void reloadDictionary(const std::string & name) { reload(name); }
DictPtr getDictionary(const std::string & name) const
{
return std::static_pointer_cast<IDictionaryBase>(getLoadable(name));
}
protected:
LoadablePtr create(const std::string & name, const Configuration & config,
const std::string & config_prefix) override;
using ExternalLoader::getObjectsMap;
friend class StorageSystemDictionaries;
friend class DatabaseDictionary;
private:
Context & context;
};
}