ClickHouse/src/Interpreters/ExternalDictionariesLoader.h
Alexander Kuzmenkov 3f57fc085b remove mutable context references from functions interface
Also remove it from some visitors.
2021-05-28 19:45:37 +03:00

52 lines
1.8 KiB
C++

#pragma once
#include <Dictionaries/IDictionary.h>
#include <Interpreters/Context_fwd.h>
#include <Interpreters/ExternalLoader.h>
#include <Common/quoteString.h>
#include <memory>
namespace DB
{
class IExternalLoaderConfigRepository;
/// Manages user-defined dictionaries.
class ExternalDictionariesLoader : public ExternalLoader, WithConstContext
{
public:
using DictPtr = std::shared_ptr<const IDictionary>;
/// Dictionaries will be loaded immediately and then will be updated in separate thread, each 'reload_period' seconds.
explicit ExternalDictionariesLoader(ContextConstPtr global_context_);
DictPtr getDictionary(const std::string & dictionary_name, ContextConstPtr context) const;
DictPtr tryGetDictionary(const std::string & dictionary_name, ContextConstPtr context) const;
void reloadDictionary(const std::string & dictionary_name, ContextConstPtr context) const;
DictionaryStructure getDictionaryStructure(const std::string & dictionary_name, ContextConstPtr context) const;
static DictionaryStructure getDictionaryStructure(const Poco::Util::AbstractConfiguration & config, const std::string & key_in_config = "dictionary");
static DictionaryStructure getDictionaryStructure(const ObjectConfig & config);
static void resetAll();
protected:
LoadablePtr create(const std::string & name, const Poco::Util::AbstractConfiguration & config,
const std::string & key_in_config, const std::string & repository_name) const override;
std::string resolveDictionaryName(const std::string & dictionary_name, const std::string & current_database_name) const;
/// Try convert qualified dictionary name to persistent UUID
std::string resolveDictionaryNameFromDatabaseCatalog(const std::string & name) const;
friend class StorageSystemDictionaries;
friend class DatabaseDictionary;
};
}