ClickHouse/programs/library-bridge/Handlers.h

53 lines
1.1 KiB
C++
Raw Normal View History

2021-03-05 09:38:00 +00:00
#pragma once
#include <Interpreters/Context.h>
#include <Server/HTTP/HTTPRequestHandler.h>
2021-03-07 15:23:20 +00:00
#include <common/logger_useful.h>
2021-03-05 09:38:00 +00:00
#include "SharedLibraryHandler.h"
namespace DB
{
2021-03-05 15:37:43 +00:00
/// Handler for requests to Library Dictionary Source, returns response in RowBinary format
2021-03-05 09:38:00 +00:00
class LibraryRequestHandler : public HTTPRequestHandler
{
public:
LibraryRequestHandler(
size_t keep_alive_timeout_,
2021-03-07 11:31:55 +00:00
Context & context_)
2021-03-05 09:38:00 +00:00
: log(&Poco::Logger::get("LibraryRequestHandler"))
, keep_alive_timeout(keep_alive_timeout_)
, context(context_)
{
}
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response) override;
private:
void processError(HTTPServerResponse & response, const std::string & message);
Poco::Logger * log;
size_t keep_alive_timeout;
Context & context;
};
class PingHandler : public HTTPRequestHandler
{
public:
explicit PingHandler(size_t keep_alive_timeout_)
: keep_alive_timeout(keep_alive_timeout_)
{
}
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response) override;
private:
size_t keep_alive_timeout;
};
}