DictionaryFactory.h 1.1 KB
Newer Older
1 2
#pragma once

3
#include "IDictionary.h"
A
alesapin 已提交
4
#include <Parsers/ASTCreateQuery.h>
A
alexey-milovidov 已提交
5

6

7 8
namespace Poco
{
9

10 11 12 13 14 15
namespace Util
{
    class AbstractConfiguration;
}

class Logger;
16

17
}
18

19

20 21
namespace DB
{
22

23 24
class Context;

25
class DictionaryFactory : private boost::noncopyable
26 27
{
public:
28 29 30

    static DictionaryFactory & instance();

A
alesapin 已提交
31 32 33 34 35 36
    DictionaryPtr create(
        const std::string & name,
        const Poco::Util::AbstractConfiguration & config,
        const std::string & config_prefix,
        const Context & context) const;

A
alesapin 已提交
37
    /// Temporary method for testing TODO(alesapin)
A
alesapin 已提交
38 39 40
    DictionaryPtr create(const std::string & name,
        const ASTCreateQuery & ast,
        const Context & context) const;
41 42 43 44 45 46 47 48 49 50 51 52 53

    using Creator = std::function<DictionaryPtr(
        const std::string & name,
        const DictionaryStructure & dict_struct,
        const Poco::Util::AbstractConfiguration & config,
        const std::string & config_prefix,
        DictionarySourcePtr source_ptr)>;

    void registerLayout(const std::string & layout_type, Creator create_layout);

private:
    using LayoutRegistry = std::unordered_map<std::string, Creator>;
    LayoutRegistry registered_layouts;
54 55 56
};

}