aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Common/ProxyListConfigurationResolver.h
blob: 95b84adfef4b9a46d4ec6e74eab4784a992b7a77 (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
#pragma once

#include <base/types.h>

#include <Common/ProxyConfigurationResolver.h>
#include <Poco/URI.h>

namespace DB
{

/*
 * Round-robin proxy list resolver.
 * */
class ProxyListConfigurationResolver : public ProxyConfigurationResolver
{
public:
    explicit ProxyListConfigurationResolver(std::vector<Poco::URI> proxies_);

    ProxyConfiguration resolve() override;

    void errorReport(const ProxyConfiguration &) override {}

private:
    std::vector<Poco::URI> proxies;

    /// Access counter to get proxy using round-robin strategy.
    std::atomic<size_t> access_counter;

};

}