aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/IO/Resource/ClassifiersConfig.h
blob: 96e2bd0f0b95ac6da2f2efed32f146645d21bf23 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once

#include <base/types.h>
#include <Poco/Util/AbstractConfiguration.h>
#include <unordered_map>

namespace DB
{

/// Mapping of resource name into path string (e.g. "disk1" -> "/path/to/class")
struct ClassifierDescription : std::unordered_map<String, String>
{
    ClassifierDescription(const Poco::Util::AbstractConfiguration & config, const String & config_prefix);
};

/*
 * Loads a config with the following format:
 * <classifiers>
 *   <classifier1>
 *     <resource1>/path/to/queue</resource1>
 *     <resource2>/path/to/another/queue</resource2>
 *   </classifier1>
 *   ...
 *   <classifierN>...</classifierN>
 * </classifiers>
 */
class ClassifiersConfig
{
public:
    ClassifiersConfig() = default;
    explicit ClassifiersConfig(const Poco::Util::AbstractConfiguration & config);

    const ClassifierDescription & get(const String & classifier_name);

private:
    std::unordered_map<String, ClassifierDescription> classifiers; // by classifier_name
};

}