2019-09-30 16:12:08 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Core/Types.h>
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <Interpreters/IExternalLoaderConfigRepository.h>
|
|
|
|
#include <Poco/Timestamp.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
/// XML config repository used by ExternalLoader.
|
|
|
|
/// Represents xml-files in local filesystem.
|
|
|
|
class ExternalLoaderXMLConfigRepository : public IExternalLoaderConfigRepository
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
ExternalLoaderXMLConfigRepository(const Poco::Util::AbstractConfiguration & main_config_, const std::string & config_key_)
|
|
|
|
: main_config(main_config_)
|
|
|
|
, config_key(config_key_)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-09-30 16:54:50 +00:00
|
|
|
/// Return set of .xml files from path in main_config (config_key)
|
2019-09-30 16:12:08 +00:00
|
|
|
std::set<std::string> getAllLoadablesDefinitionNames() const override;
|
|
|
|
|
2019-09-30 16:54:50 +00:00
|
|
|
/// Checks that file with name exists on filesystem
|
2019-09-30 16:12:08 +00:00
|
|
|
bool exists(const std::string & definition_entity_name) const override;
|
|
|
|
|
2019-10-01 08:58:47 +00:00
|
|
|
/// Return xml-file modification time via stat call
|
|
|
|
Poco::Timestamp getUpdateTime(const std::string & definition_entity_name) override;
|
2019-09-30 16:12:08 +00:00
|
|
|
|
|
|
|
/// May contain definition about several entities (several dictionaries in one .xml file)
|
|
|
|
LoadablesConfigurationPtr load(const std::string & definition_entity_name) const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
/// Main server config (config.xml).
|
|
|
|
const Poco::Util::AbstractConfiguration & main_config;
|
|
|
|
|
|
|
|
/// Key which contains path to dicrectory with .xml configs for entries
|
|
|
|
std::string config_key;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|