ClickHouse/programs/library-bridge/LibraryBridgeHandlers.h

47 lines
1.6 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>
#include <Common/logger_useful.h>
#include "ExternalDictionaryLibraryHandler.h"
2021-03-05 09:38:00 +00:00
namespace DB
{
2021-04-05 13:13:07 +00:00
/// Handler for requests to Library Dictionary Source, returns response in RowBinary format.
/// When a library dictionary source is created, it sends 'extDict_libNew' request to library bridge (which is started on first
2021-04-05 13:13:07 +00:00
/// request to it, if it was not yet started). On this request a new sharedLibrayHandler is added to a
/// sharedLibraryHandlerFactory by a dictionary uuid. With 'extDict_libNew' request come: library_path, library_settings,
2021-04-05 13:13:07 +00:00
/// names of dictionary attributes, sample block to parse block of null values, block of null values. Everything is
/// passed in binary format and is urlencoded. When dictionary is cloned, a new handler is created.
/// Each handler is unique to dictionary.
class ExternalDictionaryLibraryBridgeRequestHandler : public HTTPRequestHandler, WithContext
2021-03-05 09:38:00 +00:00
{
public:
ExternalDictionaryLibraryBridgeRequestHandler(size_t keep_alive_timeout_, ContextPtr context_);
2021-03-05 09:38:00 +00:00
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response) override;
private:
2021-03-10 18:02:43 +00:00
static constexpr inline auto FORMAT = "RowBinary";
2021-03-05 09:38:00 +00:00
Poco::Logger * log;
size_t keep_alive_timeout;
2021-03-05 09:38:00 +00:00
};
class ExternalDictionaryLibraryBridgeExistsHandler : public HTTPRequestHandler, WithContext
2021-03-05 09:38:00 +00:00
{
public:
ExternalDictionaryLibraryBridgeExistsHandler(size_t keep_alive_timeout_, ContextPtr context_);
2021-03-05 09:38:00 +00:00
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response) override;
private:
2021-04-05 14:15:10 +00:00
const size_t keep_alive_timeout;
Poco::Logger * log;
2021-03-05 09:38:00 +00:00
};
}