Repository navigation
Expand file tree
/
Copy pathClientEmbedded.h
More file actions
68 lines (47 loc) · 1.75 KB
/
Copy pathClientEmbedded.h
File metadata and controls
68 lines (47 loc) · 1.75 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once
#if defined(OS_LINUX)
#include <Client/ClientBase.h>
#include <Client/LocalConnection.h>
#include <Common/Config/ConfigProcessor.h>
#include <Poco/Util/LayeredConfiguration.h>
#include <memory>
namespace DB
{
// Client class which can be run embedded into server
class ClientEmbedded final : public ClientBase
{
public:
explicit ClientEmbedded(
std::unique_ptr<Session> && session_,
int in_fd_,
int out_fd_,
int err_fd_,
std::istream & input_stream_,
std::ostream & output_stream_,
std::ostream & error_stream_);
[[ nodiscard ]] int run(const NameToNameMap & envVars, const String & first_query);
/// NOP. The embedded client runs inside the server process which has its own signal handlers.
/// Thus we cannot override it in any way.
void setupSignalHandler() override {}
~ClientEmbedded() override { cleanup(); }
protected:
void connect() override;
Poco::Util::LayeredConfiguration & getClientConfiguration() override;
void processError(std::string_view query) const override;
String getName() const override { return "embedded"; }
void printHelpMessage(const OptionsDescription &) override;
void addExtraOptions(OptionsDescription &) override {}
void processOptions(const OptionsDescription &,
const CommandLineOptions &,
const std::vector<Arguments> &,
const std::vector<Arguments> &) override {}
void processConfig() override {}
bool isEmbeeddedClient() const override;
private:
void cleanup();
std::unique_ptr<Session> session;
ConfigurationPtr configuration;
Poco::AutoPtr<Poco::Util::LayeredConfiguration> layered_configuration;
};
}
#endif