2016-11-15 19:51:06 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <DB/Dictionaries/IDictionarySource.h>
|
2016-11-18 01:48:13 +00:00
|
|
|
#include <DB/Dictionaries/DictionaryStructure.h>
|
2016-11-15 19:51:06 +00:00
|
|
|
|
2017-01-21 04:24:28 +00:00
|
|
|
|
|
|
|
namespace Poco { class Logger; }
|
|
|
|
|
|
|
|
|
2016-11-15 19:51:06 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
/// Allows loading dictionaries from executable
|
|
|
|
class HTTPDictionarySource final : public IDictionarySource
|
|
|
|
{
|
|
|
|
public:
|
2016-11-24 01:01:11 +00:00
|
|
|
HTTPDictionarySource(const DictionaryStructure & dict_struct_,
|
|
|
|
const Poco::Util::AbstractConfiguration & config,
|
|
|
|
const std::string & config_prefix,
|
|
|
|
Block & sample_block,
|
2016-11-15 19:51:06 +00:00
|
|
|
const Context & context);
|
|
|
|
|
|
|
|
HTTPDictionarySource(const HTTPDictionarySource & other);
|
|
|
|
|
|
|
|
BlockInputStreamPtr loadAll() override;
|
|
|
|
|
|
|
|
BlockInputStreamPtr loadIds(const std::vector<UInt64> & ids) override;
|
|
|
|
|
|
|
|
BlockInputStreamPtr loadKeys(
|
|
|
|
const ConstColumnPlainPtrs & key_columns, const std::vector<std::size_t> & requested_rows) override;
|
|
|
|
|
|
|
|
bool isModified() const override;
|
|
|
|
|
|
|
|
bool supportsSelectiveLoad() const override;
|
|
|
|
|
|
|
|
DictionarySourcePtr clone() const override;
|
|
|
|
|
|
|
|
std::string toString() const override;
|
|
|
|
|
|
|
|
private:
|
2017-01-21 04:24:28 +00:00
|
|
|
Poco::Logger * log;
|
2016-11-15 19:51:06 +00:00
|
|
|
|
|
|
|
LocalDateTime getLastModification() const;
|
|
|
|
|
2016-11-18 01:48:13 +00:00
|
|
|
const DictionaryStructure dict_struct;
|
2016-11-24 01:01:11 +00:00
|
|
|
const std::string url;
|
2016-11-15 19:51:06 +00:00
|
|
|
const std::string format;
|
|
|
|
Block sample_block;
|
|
|
|
const Context & context;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|